国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C > 正文

一個(gè)win32窗口創(chuàng)建示例

2020-01-26 15:32:16
字體:
供稿:網(wǎng)友

復(fù)制代碼 代碼如下:

/*
一個(gè)簡單的win32窗口調(diào)用
*/
#include<Windows.h>
#include<tchar.h>
//聲明窗口函數(shù)
LRESULT CALLBACK WindowProc(HWND hwnd,
       UINT uMsg,
       WPARAM wParam,
       LPARAM lparam
       );
int WINAPI WinMain(
     HINSTANCE hInstance,
     HINSTANCE hPrevInatance,
     LPSTR lpCmdLine,
     int nCmdShow
     )
{
 WNDCLASS wndclass;
 wndclass.lpfnWndProc=WindowProc;
 wndclass.cbClsExtra=0;
 wndclass.cbWndExtra=0;
 wndclass.style=CS_HREDRAW|CS_VREDRAW;
 wndclass.lpszClassName=_T("我的窗體");
 wndclass.hInstance=hInstance;
 wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
 wndclass.hIcon=0;
 wndclass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
 wndclass.lpszMenuName=0;
 //注冊窗口類
 if(RegisterClass(&wndclass)==0)
 {
  MessageBox(0,_T("注冊窗口類失敗"),_T("我的窗體"),MB_OK);
  return 0;
 }
 //創(chuàng)建窗口實(shí)列
 HWND hWnd = CreateWindow(_T("我的窗體"),_T("我的第一個(gè)窗體"),WS_OVERLAPPEDWINDOW,100,100,500,400,0,0,hInstance,0);
 //顯示和更新窗口
 ShowWindow(hWnd,SW_SHOW);
 UpdateWindow(hWnd);

 //消息循環(huán)
 MSG msg;
 while(GetMessage(&msg,0,0,0))
 {
  TranslateMessage(&msg);
  DispatchMessage(&msg);
 }
 return 0;
}
//定義窗口函數(shù)
LRESULT CALLBACK WindowProc(
       HWND hwnd,
       UINT uMsg,
       WPARAM wParam,
       LPARAM IParam
       )
{
 switch(uMsg)
 {
 case WM_CLOSE:
  PostQuitMessage(0);
  break;
 default:
  return DefWindowProc(hwnd,uMsg,wParam,IParam);
 }
 return 0;
}

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 万全县| 洛川县| 景谷| 巴塘县| 正阳县| 湄潭县| 延庆县| 大余县| 淳安县| 滨海县| 涪陵区| 霞浦县| 女性| 普陀区| 拜泉县| 平果县| 咸宁市| 桐梓县| 吴旗县| 青浦区| 左贡县| 韩城市| 芒康县| 沧源| 龙门县| 鸡东县| 武强县| 天水市| 清流县| 马鞍山市| 驻马店市| 兰州市| 淅川县| 和龙市| 西峡县| 鄂州市| 浦城县| 万宁市| 边坝县| 大港区| 中牟县|