Thread: posting a mouse message to a window

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    11

    posting a mouse message to a window

    Hi,

    I'm writing an app that automates a process for me based on the log window from another 3rd party app while it is being generated.

    I've tackled the reading of the apps log window and I've ascertained that the buttons belonging to that app are somehow protected from access so I can't send messages directly to the buttons to simulate them being pressed.

    The approach I'm now taking is to set the app window pos to 0, 0 so I know the screen co-ords of the buttons and send WM_LBUTTONDOWN messages to the main app window like such

    Code:
    PostMessage ( hwnd, WM_LBUTTONDOWN, 0, button_x|(button_y<<16) );
    The app doesn't appear to register these mouse button presses though, so should I presume that the app is able to ignore user generated mouse messages ?

    I've run out of ideas now as to how I can simulate the buttons of this app being pressed. If anyone has any suggestions, no matter how convoluted, I'm all ears !

    Cheers,
    Marc

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    When you click a button, do you press the left mouse button without ever releasing it?

    Here are some options for you to try:
    - follow the down press with a WM_LBUTTONUP
    - send BN_CLICKED to the button's parent
    - use mouse_event or SendInput

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. Making dialog box the only window
    By PJYelton in forum Windows Programming
    Replies: 2
    Last Post: 09-06-2005, 12:02 PM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  5. no errors but still errors
    By Megatron in forum Windows Programming
    Replies: 7
    Last Post: 01-12-2003, 11:21 PM