请高手相助:关于Resource function 的一些古怪 呵呵,高分相送
我呢需要一个便历指定exe文件指定类型资源的一个程序
然后我这么写了
HMODULE hExe;
hExe = LoadLibrary(szFile);
if (hExe == NULL)
{
AfxMessageBox("Could not load .EXE.");
}
EnumResourceNames(hExe,RT_MENU, // module handle
(ENUMRESNAMEPROC)EnumNamesFunc, // callback function
(LPARAM)GetSafeHwnd()); // extra parameter
// Unload the executable file whose resources were
// enumerated and close the file created to contain
// the resource information.
FreeLibrary(hExe);
return 0;
}
BOOL CALLBACK EnumNamesFunc(
HMODULE hModule, // module handle
LPCTSTR lpszType, // resource type
LPTSTR lpszName, // resource name
LONG_PTR lParam // application-defined parameter
)
{
CString szString;
// Write the resource name to a resource information file.
// The name may be a string or an unsigned decimal
// integer, so test before printing.
char tmp[100];
strcpy(tmp,lpszName);
if ((ULONG)lpszName & 0xFFFF0000)
{
szString.Format("%s", lpszName);
}
g_szlRet->AddTail(szString);
return TRUE;
}
但是当我跟踪到回调函数EnumNamesFunc内部时 却发现 lpszType 和lpszName 是错误的指针(当然,这是在调试界面的监视窗口看的) 不知道是为什么??
我用的是vc7.0 ,win2000