Windows API一日一练(3)使用命令行参数

 1 #include <windows.h>
 2 #include "resource.h"
 3 //#include "windows.rc"
 4 
 5 /*  Declare Windows procedure  */
 6 LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
 7 
 8 /*  Make the class name into a global variable  */
 9 char szClassName[ ] = "CodeBlocksWindowsApp";
10 
11 int WINAPI WinMain (HINSTANCE hThisInstance,
12                      HINSTANCE hPrevInstance,
13                      LPSTR lpszArgument,
14                      int nCmdShow)
15 {
16     const int MAXSIZE_APPBUFF = 255;
17     char wAppTile[MAXSIZE_APPBUFF];
18     LoadString(hThisInstance,IDS_1,wAppTile,MAXSIZE_APPBUFF);
19     HWND hwnd = GetDesktopWindow();
20     MessageBox(hwnd,lpszArgument,"nihao",MB_OK);
21     MessageBoxA(hwnd,wAppTile,"你好",MB_OK);
22 
23       return 0;
24 }

CB编译成功  :项目 ---》设置程序参数

原文地址:https://www.cnblogs.com/rainboy/p/3500847.html