AfxGetInstanceHandle
This function allows you to retrieve the instance handle of the current application.
HINSTANCE AFXAPI AfxGetInstanceHandle( );
Return Value
An HINSTANCE to the current instance of the application. If called from within a DLL linked with the USRDLL version of MFC, an HINSTANCE to the DLL is returned.
Remarks
AfxGetInstanceHandle always returns the HINSTANCE of your executable file (.EXE) unless it is called from within a DLL linked with the USRDLL version of MFC. In this case, it returns an HINSTANCE to the DLL.
Example
C++
// Print the application instance handle to the debugger output window.
TRACE(_T("Application instance handle is 0x%0X\n"), AfxGetInstanceHandle());
http://technet.microsoft.com/zh-cn/library/36z3tfsb%28v=vs.100%29.aspx
AfxGetResourceHandle
extern HINSTANCE AfxGetResourceHandle( );
Return Value
An HINSTANCE handle where the default resources of the application are loaded.
Example
C++
//Load the menu specifying the module handle where resource is to be
//found & resource ID
HMENU hMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
http://technet.microsoft.com/zh-cn/library/zaewt3xs%28v=vs.100%29.aspx