freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

vc實(shí)驗(yàn)手冊(cè)-文庫吧

2025-06-11 00:27 本頁面


【正文】 int cbClsExtra。 //擴(kuò)展空間 int cbWndExtra。 //擴(kuò)展空間 HINSTANCE hInstance。 //實(shí)例句柄 HICON hIcon。 //圖標(biāo)設(shè)置 HCURSOR hCursor。 //光標(biāo)設(shè)置 HBRUSH hbrBackground。 //窗口背景顏色 LPCTSTR lpszMenuName。 //窗口類菜單 LPCTSTR lpszClassName。 //窗口類文本名稱} WNDCLASS, *PWNDCLASS。用WNDCLASS定義一個(gè)窗口變量,然后依次初始化起它的每一個(gè)成員,注意:第二個(gè)成員變量lpfnWndProc指定了這一類型窗口的過程函數(shù)(函數(shù)名可以作為該函數(shù)的首地址),也稱回調(diào)函數(shù)。每一種不同類型的窗口都有自己專用的回調(diào)函數(shù)。l 注冊(cè)窗口類:調(diào)用RegisterClass()函數(shù)注冊(cè)窗口,函數(shù)原型如下:ATOM RegisterClass( CONST WNDCLASS *lpWndClass )。l 創(chuàng)建窗口:調(diào)用CreateWindow()函數(shù)創(chuàng)建窗口,函數(shù)原型如下:HWND CreateWindow( LPCTSTR lpClassName, // registered class name LPCTSTR lpWindowName, // window name DWORD dwStyle, // window style int x, // horizontal position of window int y, // vertical position of window int nWidth, // window width int nHeight, // window height HWND hWndParent, // handle to parent or owner window HMENU hMenu, // menu handle or child identifier HINSTANCE hInstance, // handle to application instance LPVOID lpParam // windowcreation data)。l 顯示及更新窗口:在CreateWindow()調(diào)用返回后,Windows已經(jīng)分配了一塊內(nèi)存,用于保存創(chuàng)建窗口的全部信息,然而窗口并未在顯示器上顯示,所以需要調(diào)用ShowWindow()函數(shù)顯示窗口和UpdateWindow()更新窗口,兩個(gè)函數(shù)原型分別為:BOOL ShowWindow(HWND hWnd, // handle to window int nCmdShow // show state)。更新窗口函數(shù)原型:BOOL UpdateWindow( HWND hWnd // handle to window)。216。 消息循環(huán)當(dāng)窗口顯示在顯示器上后,程序必須準(zhǔn)備讀入用戶用鍵盤和鼠標(biāo)輸入的數(shù)據(jù)。Windows為每一個(gè)應(yīng)用程序維護(hù)一個(gè)“消息隊(duì)列”,當(dāng)發(fā)生輸入事件后,Windows將事件轉(zhuǎn)化成一個(gè)消息,并將消息放入程序的消息隊(duì)列中。程序通過執(zhí)行以下一段代碼從消息隊(duì)列中取出消息:while(GetMessage(amp。msg,NULL,0,0)) //獲取消息{TranslateMessage(amp。msg)。//消息翻譯DispatchMessage(amp。msg)。 //發(fā)送消息給窗口過程}Msg變量為MSG結(jié)構(gòu)體類型,類型定義如下:typedef struct tagMSG { HWND hwnd。 UINT message。 WPARAM wParam。 LPARAM lParam。 DWORD time。 POINT pt。 } MSG, *PMSG。216。 頭文件包含在每一個(gè)Windows程序C語言編寫的Windows程序都可以看到include。,它包含的windows的其它頭文件,這些頭文件中最重要和最基本的是:1. 基本類型定義2. 支持Unicode類型定義3. 內(nèi)核函數(shù)4. 用戶接口函數(shù)5. 圖形設(shè)備接口函數(shù) 上面程序使用到得Windows系統(tǒng)調(diào)用函數(shù)均在MSDN中平臺(tái)SDK文檔中說明,并在不同的頭文件中聲明。l 用MFC類庫實(shí)現(xiàn)HellowWorld程序216。 打開VS2005,從File菜單中選擇New,單擊Project標(biāo)簽,選擇Win32 Application,輸入項(xiàng)目名稱和工程存放目錄,選擇創(chuàng)建一個(gè)空的工程,點(diǎn)擊工程的File View,在Head ,將類的定義均放在頭文件里,需要定義兩個(gè)類:應(yīng)用程序類CMyApp類從CWinApp類繼承;窗口類CMainWindow類從CFrameWnd類繼承;向Source ,輸入類的成員函數(shù)定義。216。 選擇菜單Project/settings(或Alt+F7),在Project Settings對(duì)話框中的General頁中的Microsoft Foundation Classes:選擇Use MFC in a Static Library或Use MFC in a Shared DLL,然后編譯運(yùn)行。l SDK實(shí)現(xiàn)代碼:include include //窗口過程函數(shù)聲明:LRESULT CALLBACK WinLiuProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter)。 int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // pointer to mand line int nCmdShow // show state of window){ HWND hwnd。 //窗口句柄 MSG msg。 //消息 //聲明一個(gè)窗口類 WNDCLASS wndcls。 //設(shè)置窗口類的屬性: = 0。 = 0。 = ( HBRUSH)GetStockObject( WHITE_BRUSH )。 = LoadCursor( hInstance, IDC_ARROW )。 = LoadIcon( hInstance, IDI_APPLICATION )。 = hInstance。 = WinLiuProc。 = Windows prog test。 = NULL。 = CS_HREDRAW | CS_VREDRAW。 //注冊(cè)窗口類 RegisterClass(amp。wndcls)。 //創(chuàng)建窗口 hwnd = CreateWindow( Windows prog test, TEXT (The Hello Program,SDK style), WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL )。 //顯示窗口 ShowWindow( hwnd, SW_SHOWNORMAL )。 //更新窗口 UpdateWindow(hwnd)。 /*消息循環(huán)*/ //從消息隊(duì)列中循環(huán)讀取有效消息,如果是有效消息,則復(fù)制到msg中,然后從隊(duì)列中刪除該消息 while (GetMessage( amp。msg, NULL, 0, 0)) //當(dāng)接收到一個(gè)WM_QUIT消息后,退出消息循環(huán) { //將一個(gè)指示字符鍵的鍵盤消息轉(zhuǎn)化為容易使用的WM_CHAR消息 TranslateMessage(amp。msg)。 //將消息發(fā)送給窗口過程 DispatchMessage(amp。msg)。 } return 0。}LRESULT CALLBACK WinLiuProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter){ switch(uMsg) { //字符輸入消息 case WM_CHAR: char szChar[20]。 sprintf(szChar,鍵盤按鍵按下)。 MessageBox(hwnd,szChar,Title,0)。 break。 //鼠標(biāo)左鍵按下消息 case WM_LBUTTONDOWN: MessageBox(hwnd,左鍵按下,Title,0)。 HDC hdc。 /* retrieves a handle to a display device context (DC) for the client area of a specified window or for the entire screen */ hdc=GetDC(hwnd)。 //TextOut(hdc,0,50,after mouse left button down,show this, // strlen(after mouse left button down,show this) )。 //releases a device context (DC), ReleaseDC(hwnd,hdc)。 break。 //鼠標(biāo)右鍵按下消息 case WM_RBUTTONDOWN: MessageBox(hwnd,鼠標(biāo)右鍵按下,Title,0)。 break。 //輸出消息 case WM_PAINT: // HDC hdc。 RECT rect。 PAINTSTRUCT ps。 hdc=BeginPaint(hwnd, amp。ps) 。 GetClientRect(hwnd, amp。rect) 。 DrawText(hdc,TEXT(HelloWorld),strlen(HelloWorld), amp。rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER)。 EndPaint(hwnd, amp。ps) 。 break。 //窗口關(guān)閉消息 case WM_CLOSE: //如果接收的消息為IDYES if(IDYES==MessageBox(hwnd,是否真的結(jié)束?,lhhsoft,MB_YESNO)) { //銷毀窗口 DestroyWindow(hwnd)。//系統(tǒng)發(fā)出一個(gè)WM_DESTROY消息。 } break。 //銷毀消息 case WM_DESTROY: //退出消息循環(huán) PostQuitMessage(0)。 //發(fā)送一個(gè)WM_QUIT消息 break。 //其它消息使用默認(rèn)的窗口過程處理函數(shù)執(zhí)行 default: return DefWindowProc(hwnd,uMsg,wParam,lParam)。 } return 0。}l MFC實(shí)現(xiàn)代碼:class CMyApp:public CWinApp{public: virtual BOOL InitInstance()。//初始化窗口實(shí)例}。class CMainWindow:public CFrameWnd{public: CMainWindow()。 //主窗口構(gòu)造函數(shù)protected: afx_msg void OnPaint()。 // OnPaint消息響應(yīng)函數(shù) DECLARE_MESSAGE_MAP()}。include include CMyApp myApp。 //應(yīng)用程序?qū)ο?/CMyApp member functionsBOOL CMyApp::InitInstance(){ m_pMainWnd = new CMainWindow。 /新建一個(gè)窗口 m_pMainWndShowWindow(m_nCmdS
點(diǎn)擊復(fù)制文檔內(nèi)容
數(shù)學(xué)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1