[Herecast-commit] herecast/src/HerecastTester HerecastTester.cpp,1.2,1.3
Status: Beta
Brought to you by:
mdpaciga
|
From: Mark P. <mdp...@us...> - 2005-07-25 19:31:28
|
Update of /cvsroot/herecast/herecast/src/HerecastTester In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11349/src/HerecastTester Modified Files: HerecastTester.cpp Log Message: added example of loading the DLL dynamically Index: HerecastTester.cpp =================================================================== RCS file: /cvsroot/herecast/herecast/src/HerecastTester/HerecastTester.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HerecastTester.cpp 21 Jul 2005 20:07:03 -0000 1.2 --- HerecastTester.cpp 25 Jul 2005 19:31:20 -0000 1.3 *************** *** 20,24 **** - int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, --- 20,23 ---- *************** *** 26,29 **** --- 25,32 ---- int nCmdShow) { + HINSTANCE hDLL = NULL; + FARPROC HerecastInit = NULL; + FARPROC HerecastCleanup = NULL; + InitilizeClasses(hInstance); CreateMyWindow(hInstance); *************** *** 33,38 **** if (!g_herecast.findHerecast()) { ! MessageBox(0, TEXT("Herecast is not running"), TEXT("Error"), 0); ! return 1; } --- 36,63 ---- if (!g_herecast.findHerecast()) { ! ! hDLL = LoadLibrary(TEXT("whereami.dll")); ! ! if (!hDLL) { ! MessageBox(0, TEXT("Herecast is not running, not installed"), TEXT("Error"), 0); ! return 1; ! } ! else { ! HerecastInit = GetProcAddress((HMODULE)hDLL, TEXT("HerecastInit")); ! HerecastCleanup = GetProcAddress((HMODULE)hDLL, TEXT("HerecastCleanup")); ! ! if (!HerecastInit || !HerecastCleanup) { ! MessageBox(0, TEXT("Herecast is not running, and DLL was invalid"), TEXT("Error"), 0); ! return 1; ! } ! ! HerecastInit(); ! ! if (!g_herecast.findHerecast()) { ! MessageBox(0, TEXT("Herecast is not running, and could not load"), TEXT("Error"), 0); ! return 1; ! } ! } ! } *************** *** 62,66 **** - // Example of parsing a URL (could be any string, really) --- 87,90 ---- *************** *** 74,77 **** --- 98,108 ---- + // If the DLL was loaded dynamically, shut it down + + if (hDLL) { + HerecastCleanup(); + FreeLibrary((HMODULE)hDLL); + } + return 0; |