-
GetMessage...
Hiyas,
I've tried to write code to intercept messages from Notepad. However, when I have Notepad open and I call the GetMessage routine, VB totally freezes. I can't break it, so I have to Crtl-Alt-Del it. Any idea what's wrong and how to fix it? Here's the code.
Code:
Option Explicit
Dim Message As Msg
Dim nphwnd As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private Sub Form_Load()
nphwnd = FindWindow(vbNullString, "Untitled - Notepad")
GetMessage Message, nphwnd, 0, 0
End Sub
Thanks,
-Git
-
git, i will dig out the code for this later today, if i have time.
td.
-