I understand now, thanks.
Someone else has provided me with this code, I simply forgot to give the correct typedef:Code:#include <windows.h> #include <iostream> #define MAXMODULE 50 typedef int (WINAPI*cfunc)(HWND, LPCTSTR, LPCTSTR, UINT); void main() { HINSTANCE hLib=LoadLibrary("USER32.dll"); cfunc DoSomething; if(hLib==NULL) { std::cout << "Unable to load library!" << std::endl; std::cin.get(); return; } char mod[MAXMODULE]; GetModuleFileName((HMODULE)hLib, (LPTSTR)mod, MAXMODULE); std::cout << "Library loaded: " << mod << std::endl; DoSomething=(cfunc)GetProcAddress((HMODULE)hLib, "MessageBoxA"); if((DoSomething==NULL)) { std::cout << "Unable to load function(s)." << std::endl; FreeLibrary((HMODULE)hLib); return; } DoSomething(0, "Hello World!", "Information", MB_ICONINFORMATION); FreeLibrary((HMODULE)hLib); std::cin.get(); }
typedef int (WINAPI*cfunc)(HWND, LPCTSTR, LPCTSTR, UINT);




Reply With Quote