Demo 0021 窗體建立過程

2022-04-07 10:22:40 字數 1856 閱讀 9627

(一)建立窗體

hwnd createwindowex(dword dwexstyle,  lpctstr lpclassname,  lpctstr lpwinname, dword dwstyle, int x,  int y,  int nwidth, int nheight,

hwnd hwndparent, hmenu hmenu, hinstance hinstance, lpvoid lpparam)

hwnd createwindow(lpctstr lpclassname, lpctstr lpwinname, dword dwstyle, int x, int y, int nwidth, int nheight,

hwnd hwndparent, hmenu hmenu, hinstance hinstance, lpvoid lpparam)

此函式是createwindowex更高些的函式, 缺少窗體的擴充套件風格的設定

以下**我們分別演示兩種窗體的建立

a. 頂層窗體

hwnd

hwnd

= createwindow

(szwndclass

, szwndcaptoin

, dwstyle

, 0, 0, 800, 480,

null

, null

, hinstance

, (lpvoid

)7000);if(

null

!= hwnd

&& iswindow

(hwnd))

b. 控制項

//--: create sub control

hbutton

= createwindow(_t

("button"

), _t

("&exit"

), ws_visible

|ws_child

, 0, 0, 100, 50,

hwnd

, (hmenu

)1001,

null

, 0);

(二)建立過程中觸發的訊息

在窗體建立過程中我們將會依次觸發幾個主要訊息(當然還會有別的訊息): 

1.  wm_nccreate

2.  wm_create

3.  wm_showwindow

我們看看驗證**:

switch

(umsg

)case

wm_create

:case

wm_showwindow:

執行後結果:

create step: 1 (wm_nccreate) lparam: [instance: 0x8c0000  createparams: 7000  size: (0, 0, 800, 480)]

¡°\uc1demo0021.exe¡±: òñ¼óôø¡°\uc1c:\windows\system32\dwmapi.dll¡±

create step: 2 (wm_create) lparam: [instance: 0x8c0000  createparams: 7000  size: (0, 0, 800, 480)]

create step: 3 (wm_showwindow)

可以看到,我們在沒有看到窗體時會觸發二個訊息(wm_ncwreate, wm_create)

這兩個訊息可以lparam引數指向乙個createstruct型別的指標,其createstruct成員lpvoid lpcreateparams 接收建立函式的最後乙個引數傳遞過去的引數.

演示**

demo002 鍊錶操作

鍊錶逆序 1 鍊錶操作 該示例中,煉表頭節點不儲存資料2 1.鍊錶建立3 2.鍊錶遍歷,列印4 3.鍊錶節點長度統計5 4.鍊錶刪除6 5.插入節點7 6.刪除節點8 7.拼接鍊錶9 8.倒序 10 9.排序 1112 include 13 include 14 include 15 declara...

資料型別 Demo002 TypeConvert

package www.base boolean 1bit low high byte short char int long float double 小數優先順序高於整數,所以float比long高 byte 1byte 128 127 short 2bytes 32768 32767 char...

shell程式設計002

shell的語法 變數 變數名前面加乙個 符號來訪問它的內容,再用echo命令將它的內容輸出到終端上 read命令將使用者的輸入命令賦給乙個變數,再有echo輸出 引號的使用 新建乙個指令碼 vim variables bin sh variables執行 我們可以看出使用雙引號並不影響變數的內容,...