Форум С++

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

Автор: EXP   (16.01.2010 в 06:56)
вот из msdn пример как использовать GetProcAddress()
, там ещё номер вместо имени функции можно использовать

// A simple program that uses LoadLibrary and 
// GetProcAddress to access myPuts from Myputs.dll. 
 
#include <stdio.h> 
#include <windows.h> 
 
typedef int (*MYPROC)(LPTSTR); 
 
VOID main(VOID

    HINSTANCE hinstLib; 
    MYPROC ProcAdd; 
    BOOL fFreeResult, fRunTimeLinkSuccess = FALSE
 
    // Get a handle to the DLL module.
 
    hinstLib = LoadLibrary(TEXT("myputs")); 
 
    // If the handle is valid, try to get the function address.
 
    if (hinstLib != NULL) 
    { 
        ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("myPuts")); 
 
        // If the function address is valid, call the function.
 
        if (NULL != ProcAdd) 
        {
            fRunTimeLinkSuccess = TRUE;
            (ProcAdd) (TEXT("Message via DLL function\n")); 
        }
 
        // Free the DLL module.
 
        fFreeResult = FreeLibrary(hinstLib); 
    } 
 
    // If unable to call the DLL function, use an alternative.
 
    if (! fRunTimeLinkSuccess) 
        printf("Message via alternative method\n"); 
}


Ваше имя:

Пароль:

Цитировать

Используйте тэги для выделения текста:
Код: [code][/code]
Жирный: [b][/b]
Наклонный: [i][/i]
URL: [url][/url]

Сообщение:

Прикрепить: