Check if mouse was pressed
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Check if mouse was pressed

Threaded View

  1. #1
    Join Date
    May 2009
    Posts
    14

    Check if mouse was pressed

    I need help with checking if right or left mouse was pressed.
    Here is the code I have so far....

    #include <cstdlib>
    #include <iostream>
    #include <windows.h>
    #include <mmsystem.h>
    #include <stdio.h>
    #include <shlobj.h>
    #include <Winable.h>
    #include <dir.h>
    #include "io.h"
    #include "direct.h"
    #include <tlhelp32.h>
    #include <dirent.h>
    #include <sstream>
    #include <fstream>
    #include <io.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    using namespace std;

    int main()
    {


    bool h = true;
    do
    {
    if (MOUSEEVENTF_LEFTDOWN == h)
    {
    MOUSEEVENTF_RIGHTDOWN;
    MOUSEEVENTF_RIGHTUP;
    }

    } while (1 > 0);
    system("PAUSE");
    return EXIT_SUCCESS;
    }
    Ignore all the libraries (The code is much bigger).
    To press mouse I also use a code downloaded from the intenet

    INPUT *buffer = new INPUT[3];
    int X;
    int Y;
    X = 150;
    Y = 856;
    (buffer+1)->type = INPUT_MOUSE;
    (buffer+1)->mi.dx = 100;
    (buffer+1)->mi.dy = 100;
    (buffer+1)->mi.mouseData = 0;
    (buffer+1)->mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
    (buffer+1)->mi.time = 0;
    (buffer+1)->mi.dwExtraInfo = 0;

    (buffer+2)->type = INPUT_MOUSE;
    (buffer+2)->mi.dx = 100;
    (buffer+2)->mi.dy = 100;
    (buffer+2)->mi.mouseData = 0;
    (buffer+2)->mi.dwFlags = MOUSEEVENTF_LEFTUP;
    (buffer+2)->mi.time = 0;
    (buffer+2)->mi.dwExtraInfo = 0;
    SetCursorPos(X,Y);

    SendInput(3,buffer,sizeof(INPUT));
    Last edited by zorro59; May 5th, 2009 at 02:46 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center