{"id":33435,"date":"2024-07-04T15:40:32","date_gmt":"2024-07-04T07:40:32","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=33435"},"modified":"2024-07-04T15:40:32","modified_gmt":"2024-07-04T07:40:32","slug":"%e4%bd%bf%e7%94%a8mfc%e5%bc%80%e5%8f%91%e5%ba%94%e7%94%a8%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2024\/ruanjiankf\/33435\/","title":{"rendered":"\u4f7f\u7528mfc\u5f00\u53d1\u5e94\u7528\u5982\u4f55\u5b9e\u73b0?"},"content":{"rendered":"<p>MFC\u662fMicrosoft Foundation Classes\u7684\u7f29\u5199\uff0c\u662f\u4e00\u7ec4C++\u7c7b\u5e93\uff0c\u7528\u4e8e\u5f00\u53d1Windows\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002MFC\u63d0\u4f9b\u4e86\u4e00\u79cd\u9762\u5411\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u521b\u5efaWindows\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>MFC\u63d0\u4f9b\u4e86\u8bb8\u591a\u7c7b\uff0c\u7528\u4e8e\u5904\u7406Windows GUI\uff0c\u5305\u62ec\u7a97\u53e3<a href=\"https:\/\/exe.yimenapp.com\/tool-4029.html\">jlink\u751f\u6210exe<\/a>\u3001\u6309\u94ae\u3001\u5217\u8868\u6846\u3001\u5bf9\u8bdd\u6846\u7b49\u3002MFC\u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u7c7b\uff0c\u7528\u4e8e\u5904\u7406Windows\u6d88\u606f\uff0c\u4f8b\u5982\u9f20\u6807\u70b9\u51fb\u3001\u952e\u76d8\u8f93\u5165\u3001\u5b9a\u65f6\u5668\u7b49\u3002MFC\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7c7b\uff0c\u7528\u4e8e\u5904\u7406\u6587\u4ef6\u64cd\u4f5c\u3001\u6570\u636e\u5e93\u8bbf\u95ee\u3001\u7f51\u7edc\u7f16\u7a0b\u7b49\u3002<\/p>\n<p>MFC\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u7ed3\u6784\u662f\u4e00\u4e2aWin32\u5e94\u7528\u7a0b\u5e8f\uff0c\u5305\u542b\u4e00\u4e2aWinMain\u51fd\u6570\u3001\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7c7b\u548c\u4e00\u4e2a\u4e3b\u7a97\u53e3\u7c7b\u3002\u5e94\u7528\u7a0b\u5e8f\u7c7b\u6d3e\u751f\u81eaCWinApp\uff0c\u4e3b\u7a97\u53e3\u7c7b\u6d3e\u751f\u81eaCFrameWnd\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684MFC\u5e94\u7528\u7a0b\u5e8f\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>#include <\/p>\n<p><p>class CMyApp : public CWinApp<\/p>\n<p>{<\/p>\n<p>public:<\/p>\n<p>    virtual BOOL InitInstance();<\/p>\n<p>};<\/p>\n<p>class CMyFrameWnd : p<a href=\"https:\/\/exe.yimenapp.com\/tool-3700.html\">\u7f51\u5740\u751f\u6210exe\u8f6f\u4ef6\u5f00\u53d1<\/a>ublic CFrameWnd<\/p>\n<p>{<\/p>\n<p>public:<\/p>\n<p>    CMyFrameWnd()<\/p>\n<p>    {<\/p>\n<p>        Create(NULL, _T(&#8220;My MFC App&#8221;));<\/p>\n<p>    }<\/p>\n<p>};<\/p>\n<p>BOOL CMyApp::InitInstance()<\/p>\n<p>{<\/p>\n<p>    CMyFrameWnd* pFrameWnd = new CMyFrameWnd();<\/p>\n<p>    m_pMainWnd = pFrameWnd;<\/p>\n<p>    pFrameWnd-&gt;ShowWindow(SW_SHOW);<\/p>\n<p>    pFrameWnd-&gt;UpdateWindow();<\/p>\n<p>    return TRUE;<\/p>\n<p>}<\/p>\n<p>CMyApp theApp;<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0cCMyApp\u7c7b\u6d3e\u751f\u81eaCWinApp\uff0c\u8986\u76d6\u4e86InitInstance\u51fd\u6570\uff0c\u521b\u5efa\u4e86\u4e00\u4e2aCMyFr<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/17\/17\/27337920245.jpg\" \/><\/figure>\n<\/p>\n<p>ameWnd\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002CMyFrameWnd\u7c7b\u6d3e\u751f\u81eaCFrameWnd\uff0c\u521b\u5efa\u4e86\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u5728\u7a97\u53e3\u6807\u9898\u680f\u4e0a\u663e\u793a\u4e86&#8221;My MFC App&#8221;\u3002<\/p>\n<p>MFC\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u8fc7\u7a0b\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p>1.\u521b\u5efa\u4e00\u4e2aMFC\u5e94\u7528\u7a0b\u5e8f\u9879\u76ee\u3002\u53ef\u4ee5\u4f7f\u7528Visual Studio\u521b\u5efa\u4e00\u4e2aMFC\u5e94\u7528\u7a0b\u5e8f\u9879\u76ee\uff0c\u9009\u62e9\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\uff08\u4f8b\u5982\u5355\u6587\u6863\u5e94\u7528\u7a0b\u5e8f\u6216\u591a\u6587\u6863\u5e94\u7528\u7a0b\u5e8f\uff09\uff0c\u7136\u540e\u6839\u636e\u9700\u8981\u9009\u62e9\u5176\u4ed6\u9009\u9879\u3002<\/p>\n<p>2.\u8bbe\u8ba1\u5e94\u7528\u7a0b\u5e8f\u754c\u9762\u3002\u53ef\u4ee5\u4f7f\u7528Visual Studio\u7684\u53ef\u89c6\u5316\u8bbe\u8ba1\u5668\u6765\u8bbe\u8ba1\u5e94\u7528\u7a0b\u5e8f\u754c\u9762\uff0c\u4f8b\u5982\u6dfb\u52a0\u7a97\u53e3\u3001\u6309\u94ae\u3001\u5217\u8868\u6846\u7b49\u63a7\u4ef6\uff0c\u5e76\u8bbe\u7f6e\u5b83\u4eec\u7684\u5c5e\u6027\u3002<\/p>\n<p>3.\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\u3002\u53ef\u4ee5\u4f7f\u7528Visual Studio\u7684\u4ee3\u7801\u7f16\u8f91\u5668\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\uff0c\u5305\u62ec\u5904\u7406Windows\u6d88\u606f\u3001\u5904\u7406\u63a7\u4ef6\u4e8b\u4ef6\u3001\u5904\u7406\u6587\u4ef6\u64cd\u4f5c\u3001\u6570\u636e\u5e93\u8bbf\u95ee\u7b49\u3002<\/p>\n<p>4.\u8c03\u8bd5\u548c\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f\u3002\u53ef\u4ee5\u4f7f\u7528Visual Studio\u7684\u8c03\u8bd5\u5de5\u5177\u6765\u8c03\u8bd5\u548c\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f8b\u5982\u65ad\u70b9\u3001\u53d8\u91cf\u76d1\u89c6\u5668\u3001\u8c03\u7528\u5806\u6808\u7b49\u3002<\/p>\n<p>5.\u53d1\u5e03\u5e94\u7528\u7a0b\u5e8f\u3002\u53ef\u4ee5\u4f7f\u7528Visual Studio\u7684\u53d1\u5e03\u5411\u5bfc\u6765\u53d1\u5e03\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f8b\u5982\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3001\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f\u7b49\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u4f7f\u7528MFC\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u662f\u4e00\u79cd\u5feb\u901f\u3001\u9ad8\u6548\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u4f7f\u5f00\u53d1\u4eba\u5458\u66f4\u5bb9\u6613\u5730\u521b\u5efaWindows\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002MFC\u63d0\u4f9b\u4e86\u8bb8\u591a\u7c7b\u548c\u51fd\u6570\uff0c\u53ef\u4ee5\u5927\u5927\u7b80\u5316\u5f00\u53d1\u8fc7\u7a0b\uff0c\u5e76\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u9760\u6027\u548c\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MFC\u662fMicrosoft Foundation Classes\u7684\u7f29\u5199\uff0c\u662f\u4e00\u7ec4C++\u7c7b\u5e93\uff0c\u7528\u4e8e\u5f00\u53d1Windows\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002MFC\u63d0\u4f9b\u4e86\u4e00\u79cd\u9762\u5411\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u521b\u5efaWindows<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[30629,929,30628,11,6782],"topic":[],"class_list":["post-33435","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-phpexe","tag-929","tag-htmlexe","tag-11","tag-6782"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/33435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=33435"}],"version-history":[{"count":1,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/33435\/revisions"}],"predecessor-version":[{"id":33476,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/33435\/revisions\/33476"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=33435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=33435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=33435"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=33435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}