I've compiled a ver simple Windows program in C which uses a resource. I can find the resource easily just doing:
For testing purpose I'm executing the previous code when I clic a simple button, and it all works perfectly.Code:byte* data; HRSRC hResInfo = FindResource(NULL, "RCDATA_0", RT_RCDATA); if (hResInfo==NULL) { MessageBox(NULL, "FindResource has failed!", "", MB_OK); return -1; } HGLOBAL hResData = LoadResource(NULL, hResInfo); if (hResData==NULL) { MessageBox(NULL, "LoadResource has failed!", "", MB_OK); return -1; } data = LockResource(hResData); if (data==NULL) { MessageBox(NULL, "LockResource has failed!", "", MB_OK); return -1; }
But now I want to create a resource list, and I'm getting an error using EnumResourceTypes. This is the way I'm using this function:
And this is the callback function:Code:if (EnumResourceTypes(NULL, (ENUMRESTYPEPROC)EnumResTypeProc, 0)==0) { MessageBox(NULL, "EnumResourceTypes has failed!", "", MB_OK); return -1; }
The GetLastError function returns 998, "Invalid access to memory location". What is the problem?Code:BOOL CALLBACK EnumResTypeProc(HMODULE hModule, LPTSTR lpszType, LONG_PTR lParam) { MessageBox(NULL, lpszType, "", MB_OK); return TRUE; }



LinkBack URL
About LinkBacks


