Share via


CWinApp::LoadIcon

This method loads the icon resource named by lpszResourceName or specified by nIDResource from the executable file. LoadIcon loads the icon only if it has not been previously loaded; otherwise, it retrieves a handle of the existing resource.

You can use the LoadStandardIcon or LoadOEMIcon method to access the predefined Windows CE icons.

This method calls the Windows CE API function LoadIcon, which can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values.

HICON LoadIcon(
LPCTSTR lpszResourceName )
const; 

HICON LoadIcon(
UINT nIDResource )
const; 

Parameters

  • lpszResourceName
    Points to a null-terminated string that contains the name of the icon resource. You can also use a CString for this argument.
  • nIDResource
    Specifies the ID number of the icon resource.

Return Value

A handle to an icon if it is successful; otherwise, it is NULL.

Remarks

Windows CE does not support any of the predefined icons (IDI_*).

In Windows CE 1.0, the icon must be a two bit per pixel (.ic2) icon or a monochrome icon.

Requirements

**  Windows CE versions:** 1.0 and later
  Header file: Declared in Afxwin.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CWinApp::LoadStandardIcon, CWinApp::LoadOEMIcon