主Form发送消息
Form1:
Public Sub Btn_Click
SendMessage Me.hWnd,WM_First,0,0
SendMessage Me.hWnd,WM_Second,0,0
End Sub模块处理消息
Module1:
Public Function NewProc(...)
Select Case Msg
Case WM_Frist
MsgBox "First"
Case WM_Second
MsgBox "Second"...Case Else
...
End Select
End Function
但只处理了第一个,就是弹出了First ,我怎么才能让它弹出第一个后,点确定,再弹出第二个,求解答!
Form1:
Public Sub Btn_Click
SendMessage Me.hWnd,WM_First,0,0
SendMessage Me.hWnd,WM_Second,0,0
End Sub模块处理消息
Module1:
Public Function NewProc(...)
Select Case Msg
Case WM_Frist
MsgBox "First"
Case WM_Second
MsgBox "Second"...Case Else
...
End Select
End Function
但只处理了第一个,就是弹出了First ,我怎么才能让它弹出第一个后,点确定,再弹出第二个,求解答!
'
'嗷嗷叫的老马 收藏与整理
'
'紫水晶工作室 http://www.m5home.com/Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _
ByRef Destination As Any, _
ByRef Source As Any, _
ByVal Length As Long)
Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As LongPrivate Const WM_MOUSEMOVE As Long = &H200
Private Const WM_RBUTTONDOWN As Long = &H204
Private Const WM_RBUTTONUP As Long = &H205Private Type myXY
mX As Integer
mY As Integer
End TypeDim WithEvents oSubClass As cSubclassPrivate Sub Command1_Click()
SendMessage Me.hwnd, WM_RBUTTONDOWN, 0, 0
SendMessage Me.hwnd, WM_RBUTTONUP, 0, 0
End SubPrivate Sub Form_Load()
Set oSubClass = New cSubclass '对象实例化
oSubClass.SetMsgHook Me.hwnd '挂上自己
End SubPrivate Sub Form_Unload(Cancel As Integer)
oSubClass.SetMsgUnHook '解除子类化
Set oSubClass = Nothing '销毁对象
End SubPrivate Sub oSubClass_GetWindowMessage(Result As Long, ByVal cHwnd As Long, ByVal Message As Long, ByVal wParam As Long, ByVal lParam As Long)
Select Case Message
Case WM_MOUSEMOVE
Dim mXY As myXY
Call CopyMemory(mXY, lParam, 4) '取出坐标.
Label1.Caption = mXY.mX & "/" & mXY.mY
Case WM_RBUTTONDOWN
MsgBox "11"
Case WM_RBUTTONUP
MsgBox "22"
End Select
Result = oSubClass.CallDefaultWindowProc(cHwnd, Message, wParam, lParam)
End Sub测试了一下,确认.这是直接在这个代码上加的几句:单类模块子类化,更精简的版本,作者为PctGL(VB6.0代码)下载后把上面代码直接替换窗体中代码,再拖个按钮上去.
......
Case WM_Frist
If MsgBox("确定忽略吗", vbExclamation + vbYesNo, Me.Caption) = vbNo Then
Cancel = True
End If
Case WM_Second
...
...不知道这个有没有影响,请帮我看看!