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

腾讯云 学生专属云服务套餐 10元起购>>>   

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

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

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