Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'Icons in Win32' article by John Hornick

84 views
Skip to first unread message

Alex

unread,
Jan 24, 2003, 3:15:13 PM1/24/03
to

Hello!

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


Jeff Partch

unread,
Jan 25, 2003, 8:29:02 AM1/25/03
to
"Alex" <ale...@pisem.net> wrote in message
news:efXU5EDxCHA.2528@TK2MSFTNGP09...

> Hello!
>
> 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.

********
Try this URL...

http://msdn.microsoft.com/code/default.asp?URL=/code/sample.asp?url=/MSDN-FILES/026/002/707/msdncompositedoc.xml

********

********
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]

Alex

unread,
Jan 25, 2003, 4:34:47 PM1/25/03
to
Many thanks, Jeff!

> Try this URL...
>
>
http://msdn.microsoft.com/code/default.asp?URL=/code/sample.asp?url=/MSDN-FI
LES/026/002/707/msdncompositedoc.xml
>

Alex


0 new messages