VC++中把窗体封装到dll中并调用(国外英文资料).doc

VC++中把窗体封装到dll中并调用(国外英文资料).doc

  1. 1、本文档共18页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VC中把窗体封装到dll中并调用(国外英文资料)

VC++中把窗体封装到dll中并调用(国外英文资料) Use resources in a DLL The most commonly seen problem with DLLS is how to use dialogs in DLLS, which is a common problem about how to use resources in a DLL. Here we analyze and solve this problem from two aspects of Win32 DLL and MFC DLL. 1. The Win32 DLL Using the dialog box in the Win32 DLL is simple, you only need to add dialog-box resources in your DLL, and you can set the controls you need on the dialog. And then using DialogBox or CreateDialog these two functions (or other functions of the same effect) to create the dialog box, and define your own dialog box dialog box callback function processing the received message. Here is a concrete example to learn how to use the dialog in a Win32 DLL. Follow these steps to complete the example: 1) File - New in the VC menu to create A New Win32 dynamic-link Library project named UseDlg, and select A simple DLL project. 2) add a Dialog Resource with an ID to IDD_DLG_SHOW in the VC menu, remove the Cancel button from this Dialog, and just leave the OK button. Add an IDD_ABOUTBOX dialog with a Caption for About. Save this resource, name the resource file UseDlg. Rc. And put the resource. H and UseDlg. Rc into the project. 3) contains the resource.h in the UseDlg app and adds the following code: HINSTANCE hinst = NULL; HWND hwndDLG = NULL; BOOL CALLBACK DlgProc (HWND hDlg, UINT message, WPARAM WPARAM, LPARAM LPARAM); BOOL CALLBACK AboutProc (HWND hDlg, UINT message, WPARAM WPARAM, LPARAM LPARAM); Extern C __declspec (dllexport) void ShowDlg (); BOOL APIENTRY DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { The switch (ul_reason_for_call) { Case DLL_PROCESS_ATTACH: Hinst = (HINSTANCE) hModule; Case DLL_PROCESS_DETACH: Break; } Return TRUE; } Extern C __declspec (dllexport) void ShowDlg () { HwndDLG = CreateDialog (hinst, MAKEINTRESOURCE (IDD_DLG_SHOW), NULL, (DLGPROC). ShowWindow (hwndDLG, SW_SHOW); } BOOL CALLBACK DlgProc (HWND hDlg, UINT message, WPARAM WPARAM, LPARAM LP

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档