PRB: AfxFindResourceHandle Fails w/ Icons, Cursors, & Strings (148305)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
This article was previously published under Q148305 SYMPTOMS
AfxFindResourceHandle() fails when searching for icon (RT_ICON), cursor
(RT_CURSOR), and string resources (RT_STRING).
CAUSE
This occurs because of how the Windows API function FindResource, which is
called by AfxFindResourceHandle(), is designed.
RESOLUTION
For icons and cursors, use the RT_GROUP_ICON or RT_GROUP_CURSOR resource
type with AfxFindResourceHandle() to return the EXE or DLL instance where
the resource is located, and then call ::LoadIcon() or ::LoadCursor() to
load the resource.
For string resources, call CString::LoadString(). It will search the EXE
and MFC extension DLLs for the string resource, and load it into the
CString.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbcode kbCursor kbDLL kbIcon kbprb kbResource kbString KB148305 |
---|
|