//--------------------------------------------------------------------------- bool LoadResources() { // Load the .EXE whose resources you want to list. HANDLE hExe = LoadLibrary(Application->ExeName.c_str()); if(hExe == NULL) { MainForm->DebugEvent("LoadLibrary() Failed!"); // Add code to fail as securely as possible. return false; } //TEST!! MainForm->DebugEvent("EnumResourceNames()"); // Find the names of all resources of type lpType. EnumResourceNames(hExe, RT_RCDATA, (ENUMRESNAMEPROC)EnumNamesFunc, 0); //TEST!! MainForm->DebugEvent("FreeLibrary()"); // Unload the executable file whose resources were // enumerated and close the file created to contain // the resource information. FreeLibrary(hExe); return true; } //--------------------------------------------------------------------------- // FUNCTION: EnumNamesFunc(HANDLE, LPSTR, LPSTR, LONG) // PURPOSE: Resource name callback //--------------------------------------------------------------------------- BOOL EnumNamesFunc( HANDLE hModule, // module handle LPCTSTR lpType, // address of resource type LPTSTR lpName, // address of resource name LONG lParam) // extra parameter, could be // used for error checking { // Write the resource name to a resource information file. // The name may be a string or an unsigned decimal // integer, so test before printing. if((ULONG)lpName & 0xFFFF0000) { MainForm->ResList.push_back(lpName); } else { //TEST!! MainForm->DebugEvent("EnumNamesFunc()->sprintf(zsBuffer, \"%u\", lpName)"); char szBuffer[100]; sprintf(szBuffer, "%u", lpName); MainForm->ResList.push_back(szBuffer); } return TRUE; }