Maybe somebody give me the correct link on the code example for article
'Icons in Win32' by John Hornick.
Old link http://msdn.microsoft.com/library/samples/4493.exe is broken.
Or help me in the next question.
I want to get the bitmaps(or icons) from an exe-file, using
EnumResourceNames,
FindResource, LockResource. I'm using the next code:
BOOL EnumNamesFunc(HANDLE hModule,LPCTSTR lpType,LPTSTR lpName,LONG lParam);
......
//--------------------------------------
.......
HINSTANCE hLib=::LoadLibraryEx("target.exe", NULL,
LOAD_LIBRARY_AS_DATAFILE);
::EnumResourceNames(hLib, RT_BITMAP, (ENUMRESNAMEPROC)EnumNamesFunc, 0);
......
//---------------------------------
BOOL EnumNamesFunc(HANDLE hModule, LPCTSTR lpType, LPTSTR lpName, LONG
lParam)
{
char szBuffer[70];
if ((ULONG)lpName & 0xFFFF0000)
{
wsprintf(szBuffer, "%s\0", lpName);
}
else
{
wsprintf(szBuffer, "#%u", (USHORT)lpName);
}
HRSRC hRes=::FindResource(hModule, szBuffer, RT_BITMAP);
........
return TRUE;
}
Why the FindResource function always returns NULL, and GetLastError()
returns 1812?
Thanx in advance
Alex
********
Try this URL...
********
********
Error 1812 is ERROR_RESOURCE_DATA_NOT_FOUND, and which the documentation
says means "The specified image file did not contain a resource
section". I can't off the top of my head see why that would apply in the
context of an EnumResNamesProc, and I am unable to repro it using your
posted code and an executable I picked at random. Maybe somebody else
will have answer.
********
--
Jeff Partch [VC++ MVP]
> Try this URL...
>
>
http://msdn.microsoft.com/code/default.asp?URL=/code/sample.asp?url=/MSDN-FI
LES/026/002/707/msdncompositedoc.xml
>
Alex