-
1 HMODULE hDll =LoadLibrary("DLL.dll"); 2 pfnTestRun FuncAddress= NULL; 3 FuncAddress=(pfnTestRun)GetProcAddress(hDll,"TestRun"); 4 FreeLibrary(hDll); 5 //// 6 #include<IOSTREAM> 7 #include<WINDOWS.H> 8 usingnamespace std; 9 typedef 10 void(*pfnTestRun)(char*,int); 11 void main() 12 { 13 pfnTestRun FuncAddress= NULL; 14 HMODULE hDll =LoadLibrary("DLL.dll"); 15 if(hDll!=NULL) 16 { 17 FuncAddress=(pfnTestRun)GetProcAddress(hDll,"TestRun"); 18 if(FuncAddress!=NULL) 19 { 20 FuncAddress(NULL,0); 21 } 22 } 23 if(hDll!=NULL) 24 { 25 FreeLibrary(hDll); 26 } 27 }