AfxGetInstanceHandle & AfxGetResourceHandle
AfxGetInstanceHandle & AfxGetResourceHandle
Amamatthew 发表于4年前
AfxGetInstanceHandle & AfxGetResourceHandle
  • 发表于 4年前
  • 阅读 203
  • 收藏 0
  • 点赞 0
  • 评论 0

移动开发云端新模式探索实践 >>>   

摘要: 获得当前程序句柄以及程序的资源句柄

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

  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 67
博文 719
码字总数 76443
×
Amamatthew
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: