Thread: simluate mouse press

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    25

    simluate mouse press

    ive lloked through the forums and a code site but i cant find anything that helps me, how do i make a dos program that simulates the left mouse button being pressed, i know its possible with the keyboard (http://www.codeproject.com/system/ke...asp#xx848776xx) but im not sure with a mouse. im using borland free command line compiler with windows 98, if thats any help.
    thx a lot for any help.

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    I don't believe that console applications can interact with a mouse.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    You should be able to include windows.h and then call SendMessage. WM_LBUTTONDOWN and WM_RBUTTONDOWN are the events. What I'm sure of is what window you'd want to simulate the mouse click on.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    25
    ya microsoft suks at explaining things, i do a lot better with examples, they basically give me the syntaxt and some stuff you can put in there, and i cant understand how to do it right, ive searched the web and tried a few things but i cant figure out how to get this code to work, here it is.

    VOID mouse_event(
    DWORD dwflag,
    DWORD dx,
    DWORD dy,
    DWORD dwData,
    ULONG_PTR dwExtraInfo
    );

    can anyone just tell me how to fill thiss out?

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    25
    ya microsoft suks at explaining things, i do a lot better with examples, they basically give me the syntaxt and some stuff you can put in there, and i cant understand how to do it right, ive searched the web and tried a few things but i cant figure out how to get this code to work, here it is.

    VOID mouse_event(
    DWORD dwflag,
    DWORD dx,
    DWORD dy,
    DWORD dwData,
    ULONG_PTR dwExtraInfo
    );

    can anyone just tell me how to fill thiss out? check out the mouse_event() link for some more info on it.^ ^

  7. #7
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Google is often a good place to start when looking for sample code.
    Code:
    SetCursorPos(10, 10); /* Move the cursor to 10, 10 */
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); /* Left button down. */
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); /* Left button up. */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need Help in Mouse Pointer
    By obaid in forum C++ Programming
    Replies: 3
    Last Post: 12-07-2006, 03:33 AM
  2. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  3. Problem with Mouse Over Menu!!! HELP!!!
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2006, 02:10 AM
  4. Making a mouse hover button, API style
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 05-27-2004, 06:17 AM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM