Thread: Newb C++ Programmer

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    Newb C++ Programmer

    I'm trying to get C++ to simulate mouse clicks

    I found this on Mouse Click - C++

    Code:
       1.
          #include <iostream>
       2.
          #include <windows.h>
       3.
           
       4.
          using namespace std;
       5.
           
       6.
          int main ()
       7.
          {
       8.
          int n = 1;
       9.
          int x;
      10.
          int y;
      11.
           
      12.
          while (n !=NULL)
      13.
           
      14.
          {
      15.
           
      16.
          if(GetAsyncKeyState(VK_NUMPAD0))
      17.
          (
      18.
           
      19.
          mouse_event(MOUSEEVENT_LEFTDOWN, x, y, 100, 100));
      20.
          mouse_event(MOUSEEVENT_LEFTDOWN, x, y, 200, 200));
      21.
           
      22.
          }
      23.
           
      24.
          if(GetAsyncKeyState(VK_NUMBPAD1))
      25.
          break;
      26.
           
      27.
          }
      28.
           
      29.
          return 0;
      30.
           
      31.
           
      32.
          }
    I'm using the GUI Anjuta on ubunutu linux, and it can't execute the above code correctly
    It ends with "make: *** No rule to make target `New'. Stop."
    The File name is "New File 1"

    So if anyone could please tell me where the error is? or suggest a better way of learning how to program mouse clicks

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Hmm you seem to be a bit over your head on this one. Interacting with things like a mouse is not something you can do in a spiffy in c++. I would strongly suggest you start learning c++ from the ground up, either through a book or through tutorials (C programming.com - Your Resource for C and C++ Programming has tutorials for instance).

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You're using ubuntu, and you're trying to compile something that starts with #include <windows.h>? This isn't going to end well. (Hint: <windows.h> is for MS Windows.)

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    I am learning

    ok, I am reading some basic C++ books, but for now I really need to automate some mouse clicks.
    If someone could point me in the direction of some code that would do this, so I can experiment with where it will click.
    I was lead to belive that code I posted was for linux
    but if it's for linux then where might I find linux based C++ mouse clicks?

    I do have some previous expeirnce with Auto IT, so it's not all completely new

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by arminius View Post
    ok, I am reading some basic C++ books, but for now I really need to automate some mouse clicks.
    Y'know what... I been thinking about this since I first saw your message and I can't think of a single situation in which that is either necessary or appropriate.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by arminius View Post
    I was lead to belive that code I posted was for linux
    Look for the people pointing and laughing. Those people are not necessarily your friends.

    Quote Originally Posted by arminius View Post
    but if it's for linux then where might I find linux based C++ mouse clicks?

    I do have some previous expeirnce with Auto IT, so it's not all completely new
    Why not search the web?

  7. #7
    Registered User
    Join Date
    Jan 2011
    Posts
    4

    geees talk about grilling me

    if u must know, I just wanna automate some scanning software.
    I need to start somewhere, and maybe it's not the most efficient way, but it's where I would like to start, now what's the coding for just straight mouse clicks? for ubuntu?

  8. #8
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    #include <windows.h>

    And you are running on a Linux machine... and you are reading a C++ book?

    So what game are you trying to cheat in?

  9. #9
    Registered User
    Join Date
    Jan 2011
    Posts
    4
    this is by far the worst "help" website I've ever been in, all you guys wanna do is either make snide remarks or just mockery.
    I'll find help elsewhere

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Goal: ReactOS programmer, Tactic: Unknown?
    By Witch in forum C Programming
    Replies: 4
    Last Post: 05-29-2011, 01:02 PM
  2. Replies: 41
    Last Post: 05-12-2010, 06:47 PM
  3. dynamic array
    By mouse666666 in forum C Programming
    Replies: 36
    Last Post: 04-11-2010, 02:27 AM
  4. What game programmer should I be? need some advice.
    By m3rk in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 04-20-2009, 11:12 PM
  5. Newb C++ Programmer
    By Philandrew in forum C++ Programming
    Replies: 8
    Last Post: 10-19-2004, 08:44 PM

Tags for this Thread