Results 1 to 5 of 5

Thread: get a message send by postmessage

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    France
    Posts
    21

    Exclamation 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

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    France
    Posts
    21

    Angry Up

    Up there, does really nobody uses PostMessage ?
    Black Rose of the Artist Clan

  3. #3
    Megatron
    Guest
    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:
    1. 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
    2. Private Type POINTAPI
    3.     x As Long
    4.     y As Long
    5. End Type
    6. Private Type MSG
    7.   hwnd As Long
    8.   message As Long
    9.   wParam As Long
    10.   lParam As Long
    11.   time As Long
    12.   pt As POINTAPI
    13. End Type
    14.  
    15.  
    16. Private Sub Timer1_Timer()
    17.    
    18.     Dim tMSG As MSG
    19.    
    20.     GetMessage tMSG, hwnd, 0, 0
    21.     List1.AddItem tMSG.message
    22.     List1.ListIndex = List1.ListCount - 1
    23.    
    24. 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.

  4. #4
    Megatron
    Guest
    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.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2001
    Location
    France
    Posts
    21

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width