Article ID: 148305
Article Last Modified on 11/21/2006
// This sample code can be placed in any MFC application or DLL
// that links with the DLL version of MFC. Create an icon with ID
// IDI_ICON1 and a cursor with ID IDC_CURSOR1. Call TestLoadIconCursor
// from CWinApp::Initinstance().
HICON MyLoadIcon( LPCTSTR lpIconName )
{
return ::LoadIcon(AfxFindResourceHandle(lpIconName, RT_GROUP_ICON),
lpIconName);
}
HCURSOR MyLoadCursor ( LPCTSTR lpCursorName )
{
return ::LoadCursor(AfxFindResourceHandle(lpCursorName,
RT_GROUP_CURSOR),
lpCursorName);
}
void TestLoadIconCursor(void)
{
HICON hIcon;
HCURSOR hCur;
LPCTSTR lpcszRes;
lpcszRes = MAKEINTRESOURCE(IDI_ICON1);
hIcon = MyLoadIcon( lpcszRes );
ASSERT (hIcon != NULL);
lpcszRes = MAKEINTRESOURCE(IDC_CURSOR1);
hCur = MyLoadCursor( lpcszRes );
ASSERT (hCur != NULL);
}
Additional query words: 2.5 2.50 2.51 2.52 3.0 3.00 3.1 3.10 3.2 3.20 AfxFindResourceHandle FindResource
Keywords: kbcode kbcursor kbdll kbicon kbprb kbresource kbstring KB148305