{"id":19,"date":"2024-04-28T02:05:30","date_gmt":"2024-04-27T18:05:30","guid":{"rendered":"https:\/\/noobxiaomeng.top\/?p=19"},"modified":"2024-05-13T19:19:02","modified_gmt":"2024-05-13T11:19:02","slug":"winapi2","status":"publish","type":"post","link":"https:\/\/noobxiaomeng.top\/index.php\/2024\/04\/28\/winapi2\/","title":{"rendered":"\u4ece0\u5f00\u59cb\u7684WindowsAPI(1)\u2014\u2014\u8ba4\u8bc6Windows\u7a97\u53e3\u7a0b\u5e8f"},"content":{"rendered":"<p>WindowsAPI\u7a0b\u5e8f\u7684\u5165\u53e3\u51fd\u6570\u4e3aWinMain<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u6700\u57fa\u672c\u7684WinAPI\u7a0b\u5e8f\uff0c\u7528\u4e8e\u6253\u5370 \u201chello world\u201d<\/p>\n<pre><code class=\"language-C\">#include&lt;Windows.h&gt;\n\nint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {\n    MessageBox(NULL, TEXT(&quot;Hello World&quot;), TEXT(&quot;Caption&quot;), MB_OKCANCEL | MB_ICONINFORMATION | MB_DEFBUTTON2);\n    return 0;\n}<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<br \/>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/noobxiaomeng.top\/wp-content\/uploads\/2024\/04\/Pasted-image-20240414231058.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/noobxiaomeng.top\/wp-content\/uploads\/2024\/04\/Pasted-image-20240414231058.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><br \/>\n\u5206\u6790\u6e90\u7801\u5185\u5bb9\uff1a<br \/>\n\u5176\u4e2dMessageBox\u4e3a\u7a97\u53e3\u51fd\u6570\uff0c\u524d\u4e00\u4e2aTEXT\u4e3a\u5185\u5bb9\uff0c\u540e\u4e00\u4e2aTEXT\u4e3a\u6807\u9898\uff0c<code>MB_OKCANCEL<\/code> \u8868\u793a\u6d88\u606f\u6846\u5c06\u663e\u793a\u4e00\u4e2a\u201c\u786e\u5b9a\u201d\u6309\u94ae\u548c\u4e00\u4e2a\u201c\u53d6\u6d88\u201d\u6309\u94ae\uff0c<code>MB_ICONINFORMATION<\/code> \u8868\u793a\u6d88\u606f\u6846\u5c06\u663e\u793a\u4e00\u4e2a\u611f\u53f9\u53f7\u56fe\u6807\uff0c<code>MB_DEFBUTTON2<\/code> \u8868\u793a\u5c06\u7b2c\u4e8c\u4e2a\u6309\u94ae\uff08\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u662f\u201c\u53d6\u6d88\u201d\u6309\u94ae\uff09\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u6309\u94ae\uff0c\u5373\u6211\u4eec\u5bf9\u7a0b\u5e8f\u6309\u4e0b\u56de\u8f66\u952e\u7684\u8bdd\u4f1a\u9009\u62e9\u7b2c\u4e8c\u4e2a\u9009\u9879\u6267\u884c\u3002<\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u53e5\u67c4\u540e\u9762\u540e\u4f1a\u6709\u8be6\u7ec6\u8868\u8ff0\uff0c\u8fd9\u91cc\u5c31\u4e0d\u8fc7\u591a\u8d58\u8ff0\u4e86<\/p>\n<p>\u6b64\u5916\uff0c\u5728\u4e0a\u8ff0\u793a\u4f8b\u4ee3\u7801\u4e2d\uff0cWinMain\u51fd\u6570\u4e2d\u6709\u56db\u4e2a\u51fd\u6570\u53c2\u6570\uff0c\u5206\u522b\u662f\uff1a<\/p>\n<ul>\n<li>\n<p>1.<strong>HINCTANCE hInstance<\/strong>\uff1a<code>hInstance<\/code> \u662f\u4e00\u4e2a\u8868\u793a\u5f53\u524d\u5e94\u7528\u7a0b\u5e8f\u5b9e\u4f8b\u7684\u53e5\u67c4\uff08handle\uff09\u3002\u4f7f\u7528 <code>hInstance<\/code> \u53ef\u4ee5\u8bbf\u95ee\u5e94\u7528\u7a0b\u5e8f\u7684\u8d44\u6e90\uff0c\u6bd4\u5982\u56fe\u6807\u3001\u5bf9\u8bdd\u6846\u3001\u83dc\u5355\u7b49\u3002\u5728\u7f16\u5199 Windows \u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u901a\u5e38\u9700\u8981\u5728\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u65f6\u83b7\u53d6 <code>hInstance<\/code>\uff0c\u4ee5\u4fbf\u6b63\u786e\u5730\u52a0\u8f7d\u548c\u4f7f\u7528\u8fd9\u4e9b\u8d44\u6e90\u3002<\/p>\n<\/li>\n<li>\n<p>2.<strong>HINSTANCE hPrevInstace<\/strong>\uff1a<code>hPrevInstance<\/code> \u662f\u4e00\u4e2a\u8868\u793a\u5148\u524d\u5b9e\u4f8b\u7684\u53e5\u67c4\uff08handle\uff09\u7684\u53c2\u6570\u3002\u8fd9\u4e2a\u53c2\u6570\u901a\u5e38\u7528\u4e8e\u6307\u793a\u5148\u524d\u8fd0\u884c\u7684\u5b9e\u4f8b\u662f\u5426\u4ecd\u7136\u5728\u5185\u5b58\u4e2d\u3002\u5728\u65e9\u671f\u7684 Windows \u7248\u672c\u4e2d\uff0c\u5f53\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u88ab\u542f\u52a8\u65f6\uff0cWindows \u4f1a\u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u6709\u4e00\u4e2a\u76f8\u540c\u7684\u5b9e\u4f8b\u6b63\u5728\u8fd0\u884c\u3002\u5982\u679c\u662f\uff0c\u5219\u5c06\u5148\u524d\u7684\u5b9e\u4f8b\u53e5\u67c4\u4f20\u9012\u7ed9\u65b0\u5b9e\u4f8b\uff0c\u4ee5\u4fbf\u65b0\u5b9e\u4f8b\u53ef\u4ee5\u4e0e\u5148\u524d\u7684\u5b9e\u4f8b\u8fdb\u884c\u901a\u4fe1\u6216\u5171\u4eab\u8d44\u6e90\u3002\u4f46\u662f\uff0c\u4ece Windows XP \u5f00\u59cb\uff0c\u8fd9\u4e2a\u53c2\u6570\u59cb\u7ec8\u4e3a NULL\uff0c\u56e0\u4e3a Windows \u5df2\u7ecf\u4e0d\u518d\u4f7f\u7528\u5b83\u6765\u4f20\u9012\u5148\u524d\u5b9e\u4f8b\u7684\u53e5\u67c4\u3002\u56e0\u6b64\uff0c\u867d\u7136 <code>hPrevInstance<\/code> \u53c2\u6570\u4ecd\u7136\u5b58\u5728\u4e8e WinMain \u51fd\u6570\u7684\u53c2\u6570\u5217\u8868\u4e2d\uff0c\u4f46\u5b83\u57fa\u672c\u4e0a\u88ab\u5f03\u7528\u4e86\uff0c\u73b0\u5728\u51e0\u4e4e\u603b\u662f\u88ab\u8bbe\u7f6e\u4e3a NULL\u3002\u5728\u7f16\u5199 Windows \u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u901a\u5e38\u4e0d\u9700\u8981\u5173\u6ce8 <code>hPrevInstance<\/code> \u53c2\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>3.LPSTR lpCmdLine:\u8fd9\u662f\u4e00\u4e2a\u6307\u5411\u5e94\u7528\u7a0b\u5e8f\u547d\u4ee4\u884c\u53c2\u6570\u5b57\u7b26\u4e32\u7684\u6307\u9488\uff0c\u4e0d\u5305\u62ec\u53ef\u6267\u884c\u6587\u4ef6\u540d\u3002\u8981\u83b7\u53d6\u6574\u4e2a\u547d\u4ee4\u884c\uff0c\u53ef\u4ee5\u8c03\u7528GetCommangLine\u51fd\u6570\uff0c\u4f8b\u5982\uff0c\u5728D\u76d8\u4e0b\u6709\u4e00\u4e2a111.txt\u6587\u4ef6\uff0c\u5f53\u6211\u4eec\u7528\u9f20\u6807\u53cc\u51fb\u542f\u52a8\u8fd9\u4e2a.txt\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5148\u542f\u52a8\u7684\u662f\u8bb0\u4e8b\u672c\u7a0b\u5e8f\uff0c\u6b64\u65f6\u7cfb\u7edf\u4f1a\u5c06<code>D:\\111.txt<\/code>\u4f5c\u4e3a\u547d\u4ee4\u884c\u53c2\u6570\u4f20\u9012\u7ed9\u8bb0\u4e8b\u672c\u7a0b\u5e8f\u7684WinMain\u51fd\u6570\uff0c\u8bb0\u4e8b\u672c\u7a0b\u5e8f\u5728\u5f97\u5230\u8fd9\u4e2a\u6587\u4ef6\u7684\u8def\u5f84\u540e\uff0c\u5c31\u4f1a\u5728\u7a97\u53e3\u4e2d\u663e\u793a\u8be5\u6587\u4ef6\u3002<\/p>\n<\/li>\n<li>\n<p>4.int nCmdShow\uff1a\u6307\u5b9a\u5e94\u7528\u7a0b\u5e8f\u6700\u521d\u5982\u4f55\u663e\u793a\uff0c\u4f8b\u5982\u8fd9\u91cc\u662f\u6b63\u5e38\u663e\u793a\uff0c\u4f46\u6211\u4eec\u8fd8\u53ef\u4ee5\u5c06\u7a97\u53e3\u6700\u5927\u5316\u663e\u793a\u7b49\u591a\u79cd\u663e\u793a\u65b9\u5f0f<\/p>\n<\/li>\n<\/ul>\n<p>\u4ecb\u7ecd\u5b8c\u4e86WinMain\u7684\u53c2\u6570\uff0c\u4e0b\u9762\u6765\u8bb2\u4e00\u4e0bMessageBox\u51fd\u6570\uff0c\u5176\u540c\u6837\u4e5f\u5305\u542b\u56db\u4e2a\u53c2\u6570\uff1a<\/p>\n<pre><code class=\"language-C\">int WINAPI MessageBoxW(\n    _In_opt_ HWND hWnd,            \/\/\u7a97\u53e3\u53e5\u67c4\n    _In_opt_ LPCWSTR lpText,       \/\/\u8981\u663e\u793a\u7684\u6d88\u606f\u5185\u5bb9\n    _In_opt_ LPCWSTR lpCaption,    \/\/\u6d88\u606f\u6846\u6807\u9898\n    _In_ UINT uType);              \/\/\u6d88\u606f\u6846\u663e\u793a\u7684\u56fe\u6807\u548c\u6309\u94ae\u6837\u5f0f<\/code><\/pre>\n<p><code>MessageBox<\/code>\u51fd\u6570\u7684\u529f\u80fd\u662f\u663e\u793a\u4e00\u4e2a\u53c2\u6570\u63d0\u793a\u6846\uff0c\u5176\u4e2d\u53ef\u4ee5\u5305\u542b\u4e00\u4e2a\u7cfb\u7edf\u56fe\u6807\uff0c\u4e00\u7ec4\u6309\u94ae\u3001\u4e00\u4e2a\u6d88\u606f\u6807\u9898\u548c\u4e00\u6761\u7b80\u77ed\u7684\u6d88\u606f\u5185\u5bb9\uff0c\u8fd9\u4e2a\u51fd\u6570\u6709\u5f88\u591a\u5e38\u91cf\uff0c\u8fd9\u91cc\u4f1a\u4e00\u4e00\u7ed9\u5927\u5bb6\u4ecb\u7ecd<\/p>\n<p>\u8fd9\u91cc\u662f\u4e00\u4e9b\u6309\u94ae\u7684\u6837\u5f0f\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u5e38\u91cf<\/th>\n<th style=\"text-align: center;\">\u663e\u793a\u7684\u6309\u94ae<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">MB_ABORTRETRYIGNORE<\/td>\n<td style=\"text-align: center;\">\u4e2d\u6b62\u3001\u91cd\u8bd5\u548c\u5ffd\u7565<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_CANCELTRYCONTINUE<\/td>\n<td style=\"text-align: center;\">\u53d6\u6d88\u3001\u91cd\u8bd5\u548c\u5ffd\u7565<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_HELP<\/td>\n<td style=\"text-align: center;\">\u786e\u5b9a\u3001\u5e2e\u52a9<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_OK<\/td>\n<td style=\"text-align: center;\">\u786e\u5b9a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_OKCANCLE<\/td>\n<td style=\"text-align: center;\">\u786e\u5b9a\u3001\u53d6\u6d88<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_RETRYCANCEL<\/td>\n<td style=\"text-align: center;\">\u91cd\u8bd5\u3001\u53d6\u6d88<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_YESNO<\/td>\n<td style=\"text-align: center;\">\u662f\u3001\u5426<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">MB_YESNOANCEL<\/td>\n<td style=\"text-align: center;\">\u662f\u3001\u5426\u548c\u53d6\u6d88<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u662f\u4e00\u4e9b\u56fe\u6807\u7684\u6837\u5f0f\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5e38\u91cf<\/th>\n<th>\u663e\u793a\u7684\u56fe\u6807<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>MB_ICONEXCLAMATION<\/td>\n<td>\u611f\u53f9\u53f7\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONWARNING<\/td>\n<td>\u611f\u53f9\u53f7\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONINFORMATION<\/td>\n<td>\u5728\u4e00\u4e2a\u5706\u5708\u4e2d\u6709\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcdi\u7ec4\u6210\u7684\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONASTERISK<\/td>\n<td>\u5728\u4e00\u4e2a\u5706\u5708\u4e2d\u6709\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcdi\u7ec4\u6210\u7684\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONQUESTION<\/td>\n<td>\u95ee\u53f7\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONSTOP<\/td>\n<td>\u505c\u6b62\u6807\u5fd7\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONERROR<\/td>\n<td>\u505c\u6b62\u6807\u5fd7\u56fe\u6807<\/td>\n<\/tr>\n<tr>\n<td>MB_ICONHAND<\/td>\n<td>\u505c\u6b62\u6807\u5fd7\u56fe\u6807<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u867d\u7136\u5b83\u4eec\u7684\u63cf\u8ff0\u76f8\u540c\uff0c\u4f46\u5177\u4f53\u7684\u56fe\u6807\u8fd8\u662f\u6709\u4e00\u4e9b\u533a\u522b\u7684<\/p>\n<p>\u4e0b\u9762\u662f\u7528\u6765\u6307\u5b9a\u6d88\u606f\u6846\u9ed8\u8ba4\u6309\u94ae\u7684\u53c2\u6570\uff0c\u6309\u4e0bEnter\u952e\u5c31\u76f8\u5f53\u4e8e\u5355\u51fb\u4e86\u8fd9\u4e2a\u6309\u94ae<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5e38\u91cf<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>MB_DEFBUTTON1<\/td>\n<td>\u7b2c1\u4e2a\u6309\u94ae\u662f\u9ed8\u8ba4\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>MB_DEFBUTTON2<\/td>\n<td>\u7b2c2\u4e2a\u6309\u94ae\u662f\u9ed8\u8ba4\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>MB_DEFBUTTON3<\/td>\n<td>\u7b2c3\u4e2a\u6309\u94ae\u662f\u9ed8\u8ba4\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>MB_DEFBUTTON4<\/td>\n<td>\u7b2c4\u4e2a\u6309\u94ae\u662f\u9ed8\u8ba4\u6309\u94ae<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>MessageBox\u51fd\u6570\u6267\u884c\u6210\u529f\u4f1a\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\uff0c\u7528\u4e8e\u6307\u660e\u7528\u6237\u5355\u51fb\u4e86\u54ea\u4e2a\u6309\u94ae\uff0c\u5982\u4e0b\u8868<\/p>\n<table>\n<thead>\n<tr>\n<th>\u8fd4\u56de\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>IDABORT<\/td>\n<td>\u5355\u51fb\u4e86\u4e2d\u6b62\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDCANCEL<\/td>\n<td>\u5355\u51fb\u4e86\u53d6\u6d88\u6309\u94ae\uff0c\u82e5\u6d88\u606f\u6846\u6709\u53d6\u6d88\u6309\u94ae\uff0c\u5219\u5f53\u6309\u4e0bEsc\u952e\u6216\u5355\u51fb\u53d6\u6d88\u6309\u94ae\u65f6\uff0c\u51fd\u6570\u90fd\u5c06\u8fd4\u56deIDCANCEL<\/td>\n<\/tr>\n<tr>\n<td>IDCONTINUE<\/td>\n<td>\u5355\u51fb\u4e86\u7ee7\u7eed\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDIGNORE<\/td>\n<td>\u5355\u51fb\u4e86\u5ffd\u7565\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDNO<\/td>\n<td>\u5355\u51fb\u4e86\u5426\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDOK<\/td>\n<td>\u5355\u51fb\u4e86\u786e\u5b9a\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDRETRY<\/td>\n<td>\u5355\u51fb\u4e86\u91cd\u8bd5\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDTRYAGAIN<\/td>\n<td>\u5355\u51fb\u4e86\u91cd\u8bd5\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>IDYES<\/td>\n<td>\u5355\u51fb\u4e86\u662f\u6309\u94ae<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\u7a0b\u5e8f\uff1a<\/p>\n<pre><code class=\"language-C\">#include&lt;Windows.h&gt;\n\nint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {\n    int nRet=MessageBox(NULL, TEXT(&quot;Hello World&quot;), TEXT(&quot;Caption&quot;), MB_OKCANCEL | MB_ICONINFORMATION | MB_DEFBUTTON2);\n    switch (nRet) {\n    case IDOK:\n        MessageBox(NULL, TEXT(&quot;\u7528\u6237\u5355\u51fb\u4e86\u786e\u5b9a\u6309\u94ae&quot;), TEXT(&quot;Caption&quot;), MB_OK);\n        break;\n    case IDCANCEL:\n        MessageBox(NULL, TEXT(&quot;\u7528\u6237\u5355\u51fb\u4e86\u53d6\u6d88\u6309\u94ae&quot;), TEXT(&quot;Caption&quot;), MB_OK);\n        break;\n    }\n    return 0;\n}<\/code><\/pre>\n<p>\u5f53\u6211\u4eec\u5355\u51fb\u786e\u5b9a\u6216\u8005\u53d6\u6d88\u65f6\uff0c\u5c31\u4f1a\u663e\u793a\u5bf9\u5e94\u7684\u8f93\u51fa\u7a97\u53e3\u3002\u6b64\u5916\uff0c\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u51fa\u73b0\u4e86\u975e\u5e38\u91cd\u8981\u7684\u4e00\u4e2a\u4e1c\u897f\u2014\u2014TEXT\u5b8f\uff0c\u5728\u5934\u6587\u4ef6\u4e2d\u6709\u5982\u4e0b\u5b9a\u4e49<\/p>\n<pre><code class=\"language-C\">#define __TEXT(quote) L##quote      \/\/ r_winnt\n\n#else   \/* UNICODE *\/               \/\/ r_winnt\n\n#ifndef _TCHAR_DEFINED\ntypedef char TCHAR, *PTCHAR;\ntypedef unsigned char TBYTE , *PTBYTE ;\n#define _TCHAR_DEFINED\n#endif \/* !_TCHAR_DEFINED *\/\n\ntypedef LPCH LPTCH, PTCH;\ntypedef LPCCH LPCTCH, PCTCH;\ntypedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;\ntypedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;\ntypedef PZZSTR PZZTSTR, PUZZTSTR;\ntypedef PCZZSTR PCZZTSTR, PCUZZTSTR;\ntypedef PZPSTR PZPTSTR;\ntypedef PNZCH PNZTCH, PUNZTCH;\ntypedef PCNZCH PCNZTCH, PCUNZTCH;\n#define __TEXT(quote) quote         \/\/ r_winnt\n\n#endif \/* UNICODE *\/                \/\/ r_winnt\n#define TEXT(quote) __TEXT(quote)   \/\/ r_winnt\n<\/code><\/pre>\n<p>\u5176\u4e2d<code>##<\/code>\u4e3a\u201d\u4ee4\u724c\u7c98\u8d34\u201c\uff0c\u8868\u793a\u628a\u5b57\u6bcdL\u548c\u5b8f\u53c2\u6570\u62fc\u63a5\u5728\u4e00\u8d77\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u5b8f\u53c2\u6570quote\u662f\u201dHello\u201c\uff0c\u90a3\u4e48<code>L##quote<\/code>\u5c31\u662f<code>L&quot;Hello&quot;<\/code>\u3002<br \/>\n\u4e5f\u8bb8\u7528\u4ee3\u7801\u7684\u5f62\u5f0f\u4f1a\u66f4\u52a0\u4fbf\u4e8e\u7406\u89e3\uff1a<\/p>\n<pre><code class=\"language-C\">TCHAR szBuf[] = TEXT(&quot;C\u8bed\u8a00&quot;);<\/code><\/pre>\n<p>\u81f3\u6b64\uff0c\u6211\u4eec\u5bf9WinAPI\u4e5f\u8bb8\u6709\u4e86\u4e00\u4e2a\u5927\u6982\u7684\u8ba4\u77e5\uff0c\u8fd9\u4e00\u8282\u7684\u5185\u5bb9\u5df2\u7ecf\u53ef\u4ee5\u5e26\u6211\u4eec\u79bb\u5f00\u9ed1\u6f06\u6f06\u7684\u63a7\u5236\u53f0\u7a97\u53e3\uff0c\u4e4b\u540e\u7684\u7a0b\u5e8f\u4f1a\u66f4\u52a0\u4e30\u5bcc\u591a\u5f69<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48\u6211C\u548cC++\u5199\u51fa\u6765\u7684\u7a0b\u5e8f\u90fd\u53ea\u6709\u9ed1\u6f06\u6f06\u7684\u63a7\u5236\u53f0\u7a97\u53e3\uff0c\u800c\u5e02\u9762\u4e0a\u7684\u8f6f\u4ef6\u90fd\u4e0d\u957f\u8fd9\u6837\u3002<br \/>\n\u54a6\uff1f\u4f60\u5199\u51fa\u6765\u7684\u4e3a\u4ec0\u4e48\u548c\u6211\u7684\u4e0d\u4e00\u6837<\/p>\n","protected":false},"author":1,"featured_media":15,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windowapi"],"_links":{"self":[{"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":8,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":291,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/posts\/19\/revisions\/291"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/media\/15"}],"wp:attachment":[{"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/noobxiaomeng.top\/index.php\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}