日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

mfc编程 孙鑫_孙鑫MFC学习笔记7:对话框编程(上)

發布時間:2024/1/1 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mfc编程 孙鑫_孙鑫MFC学习笔记7:对话框编程(上) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.DoModal創建模態對話框

2.Create創建非模態對話框(需要用ShowWindow顯示出來)

模態:對話框顯示,程序會暫停,直到對話框關閉

非模態:對話框顯示,程序繼續執行

3.對于模態對話框,點擊確定/取消對話框被銷毀,而對于模態對話框,只是被隱藏

4.對于模態對話框,需要在自己的類中覆蓋OnOK這個虛函數,在OnOK中調用DestroyWindow

5.GetWindowText獲取窗口文本

6.GetDlgItem獲取對話框控件指針

7.SetWindowText設置窗口文本

8.靜態文本框(標簽)不能接收通知消息,除非把notify復選上

9.GetDlgItemText獲取控件文本

10.SetDlgItemText設置控件文本

11.GetDlgItemInt獲取控件數字

12.SetDlgItemInt設置控件數字

13.UpdateData參數為TRUE,獲取數據,參數為FALSE,設置數據

在類向導里添加關聯成員變量

14.WM_GETTEXT消息獲取控件文本

An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

(HWND) hWnd, // handle to destination window

WM_GETTEXT, // message to send

(WPARAM) wParam, // number of characters to copy

(LPARAM) lParam // text buffer

);

15.WM_SETTEXT設置控件文本

wParam必須為0

16.SendDlgItemMessage向控件發送消息

17.EM_SETSEL

EM_SETSEL

The EM_SETSEL message selects a range of characters in an edit control. You can send this message to either an edit control or a rich edit control.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

(HWND) hWnd, // handle to destination window

EM_SETSEL, // message to send

(WPARAM) wParam, // starting position

(LPARAM) lParam // ending position

);

18.EM_GETSEL

EM_GETSEL

The EM_GETSEL message retrieves the starting and ending character positions of the current selection in an edit control. You can send this message to either an edit control or a rich edit control.

To send this message, call the SendMessage function with the following parameters.

SendMessage(

(HWND) hWnd, // handle to destination window

EM_GETSEL, // message to send

(WPARAM) wParam, // starting position (LPDWORD)

(LPARAM) lParam // ending position (LPDWORD)

);

19.SetFocus設置焦點

20.GetFocus 獲取焦點所在窗口

21.

22.IsRectEmpty判斷矩形區域面積是否為0

23IsRectNull判斷矩形區域四個參數是否都為0

24.

25.

26.

27.SetWindowPos可以改變窗口大小、z-order等狀態

28.SetWindowLong設置窗口屬性

29.WM_INITDIALOG在對話框創建前產生

30.GetNextWindow獲取下一個窗口句柄

31.GetWindow獲取窗口句柄

32.GetNextDlgTabItem獲取下一個tab窗口

33.IDOK是OK按鈕的缺省消息ID,不是IDC_OK

?用菊子曰寫博客,就是爽!

總結

以上是生活随笔為你收集整理的mfc编程 孙鑫_孙鑫MFC学习笔记7:对话框编程(上)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。