Windows API一日一练(2) 使用应用程序句柄

学习自:http://blog.csdn.net/caimouse/article/details/1676859

用Resedit 添加了 rc资源文件后  CB编译成功;

 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     MessageBoxA(hwnd,wAppTile,"你好",MB_OK);
21       return 0;
22 }

 

 

posted @ 2014-01-01 19:32  rainboy  阅读(203)  评论(0)    收藏  举报