Thread: Simulate Left Mouse Button (VK_LBUTTON)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by Vicious View Post
    The OP is using .NET, but I believe he's attempting calls out of a win32 api dll so it should be enough to send you in the right direction.
    It's the wrong direction (explanations in MSDN)
    The right method is SI()

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Since you posted in the Windows forum and not the C# forum, I'll assume you want to simulate a left mouse button using Win32 API.

    With that said, give the following a try to see if it works:

    Code:
      INPUT    Input={0};
      // left MB down 
      Input.type      = INPUT_MOUSE;
      Input.mi.dwFlags  = MOUSEEVENTF_LEFTDOWN;
      SendInput(1,&Input,sizeof(Input));
      // lef MB up
      ZeroMemory(&Input,sizeof(INPUT));
      Input.type      = INPUT_MOUSE;
      Input.mi.dwFlags  = MOUSEEVENTF_LEFTUP;
      SendInput(1,&Input,sizeof(Input));

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. Code for holding down right mouse button
    By Bill83 in forum Windows Programming
    Replies: 2
    Last Post: 03-04-2006, 07:28 PM
  3. Release Configuration Problems
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2002, 04:54 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Please help me
    By teedee46 in forum C++ Programming
    Replies: 9
    Last Post: 05-06-2002, 11:28 PM