Page 1 of 1

Moving Thy Cursor...

Posted: February 15th, 2005, 10:39 pm
by AmaD
Right 'ho, I've been on MSDN etcetera and I found that the code (albeit very simple :) ) To move the cursor on screen is:

Code: Select all

[i]
[/i]BOOL SetCursorPos(      

    int X,
    int Y
);
And so I made an application with the following code half expecting it to work:

Code: Select all

[i]
[/i]#include <iostream>
using namespace std;

int main()
{
 return 0;
}

BOOL SetCursorPos(      

    int 400,
    int 500
);
As you can see, this script has no structure, no anything, and the author has no clue :( All I want to do is move the cursor to that position (and after the initial move, probably more) Can anyone help me please :) (I'm very new to C++ you see...)

Posted: February 17th, 2005, 4:04 am
by Smartweb
Add a #include <windows> at the top. Then try adding a line like SetCursorPos(x, y) where x and y are replaced with real values above hte return 0 statement.

Posted: February 18th, 2005, 10:28 pm
by AmaD
thanks for the help ;) I get one error now which is something like

Code: Select all

Cannot open include file: 'windows': No such file or directory
Error executing cl.exe.
with the #Include that you suggested :( It looks like it could work but it's just something wrong with the include. Thanks for the help again :)

Posted: February 18th, 2005, 10:38 pm
by Smartweb
3 quesions: - Are you using #Include or #include - What compiler and what OS - Does it work if you try windows.h

Posted: February 18th, 2005, 10:44 pm
by AmaD
Hey man I love you. I tried windows.h and tada! It worked! I'm on Windows XP by the way, using Microsoft Visual Basic 6.0 to compile, but I also have a blodshed compiler but I don't like it :) Thanks ever so much