VB postmessage的使用方法要详细

来源:百度知道 编辑:UC知道 时间:2024/05/19 20:00:02
postmessage的API函数不是明白是什么意思 也不会使用所以请各位高人求教下 第一先告我下是什么意思 具体是干什么的要白话 之后告我下任何使用 都有什么相应的函数 跪求了 先给20 回答好了一定加分

将一条消息投递到指定窗口的消息队列
第一个参数就是要投递消息的控件或窗口句柄~
第二个是消息常数

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Dim hwd As Long
Private Sub Command1_Click()
Shell "notepad.exe", 1
hwd = FindWindow(vbNullString, "无标题 - 记事本")
End Sub
Private Sub Command2_Click()
PostMessage hwd, &H10, 0, 0
End Sub
Private Sub Form_Load()
Command1.Caption = "打开记事本"
Command2.Caption = "关闭记事本"
End Sub

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByV