欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2014年04月27日 11:31:28   作者:  
這篇文章主要介紹了一個win32窗口創(chuàng)建示例,需要的朋友可以參考下

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

/*
一個簡單的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)建窗口實列
 HWND hWnd = CreateWindow(_T("我的窗體"),_T("我的第一個窗體"),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;
}

相關(guān)文章

最新評論