|
-
Jul 2nd, 2001, 03:54 AM
#1
Thread Starter
Junior Member
get a message send by postmessage
Hello,
I'm trying to make an graphic user interface for an app running in dos mode; This app (programmed in c) send messages using the PostMessage API.
I cant call this app and tell it to send the message to my GUI by putting a GetForegroundWindow in the command line, but how can I get back those messages. I tried PeekMessage but I always obtain a message the text (MyMessage.message) of which is 512.
So, what did I do wrong ?
Thanks for any help.
Black Rose of the Artist Clan
-
Jul 3rd, 2001, 07:36 AM
#2
Thread Starter
Junior Member
Up
Up there, does really nobody uses PostMessage ?
Black Rose of the Artist Clan
-
Jul 3rd, 2001, 11:04 AM
#3
No, you're doing it right. The reason you're getting 512 is because that's the "code" for the WM_MOUSEMOVE event. Because you move your mouse almost all the time, it will appear like it's the only message.
Add this to a Form with a Timer and a ListBox.
VB Code:
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 Timer1_Timer()
Dim tMSG As MSG
GetMessage tMSG, hwnd, 0, 0
List1.AddItem tMSG.message
List1.ListIndex = List1.ListCount - 1
End Sub
Now try different things like clicking the mouse buttons, or clicking the title bar etc. and you'll see that different messages appear in the listbox.
-
Jul 5th, 2001, 08:47 AM
#4
Not even the MouseMove (512) messages are showing up?
Also, change the Timer's interval to a lower value. Maybe it's "too slow" to catch some of the messages.
-
Jul 5th, 2001, 10:21 AM
#5
Thread Starter
Junior Member
Yes I've got them, and all the number correspnding to movement upon other windows, controls....
Thus, when I let the mouse stand still, I have a 0 at each timer interval
Maybe someone know what message 0 is.
One more thing, when I get the name of the sender (using another API the name of which I don't remeber, but which give the sender name knowing it's Hwnd) there is a name when I move the mouse on another window but here the name is >< (I mean nothing, Null)
Black Rose of the Artist Clan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|