This is...

Started by
7 comments, last by aleksi1578 18 years, 10 months ago
This is very noobish question but i cant find information about this.. So does anyone know where i could find how to make the mouse things.. like moving to x,y . and also i need info how to see where the cursor is (x,y). any tutorials out there that tells about these mouse commands heh.
Advertisement
GetCursorPos
SetCursorPos
Quote:Original post by eq
GetCursorPos
SetCursorPos


Cant get that GetCursorPos working i have tried everything i get this error...
--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
C:\Documents and Settings\.oO\My Documents\projects\main.cpp(10) : error C2373: 'GetCursorPos' : redefinition; different type modifiers
d:\programz\microsoft visual studio\vc98\include\winuser.h(6261) : see declaration of 'GetCursorPos'
Error executing cl.exe.

main.exe - 1 error(s), 0 warning(s)
Can you post the (interesting) code of your main.cpp? It seems you are either using it wrong or there is some version conflict in the SDK, as far as I can tell now.

Greetz,

Illco
Quote:Original post by Illco
Can you post the (interesting) code of your main.cpp? It seems you are either using it wrong or there is some version conflict in the SDK, as far as I can tell now.

Greetz,

Illco


Well i have been just testing these out.. I havent got it working with any settings.. well here is it.. (its not even interesting just testing that function out to use it on my projects later.Need this for my little program at this moment.)
#include <iostream.h>
#include <windows.h>

void main ()
{
BOOL GetCursorPos(

LPPOINT lpPoint
);
cout << "Mouse position is :";
}
I hope this helps by the way dont notice about that mouse position thing its not mistake! oh and im using VC++ 6.0
Why did you put the return type (i.e. BOOL) in front of the function call. The compiler thinks you are defining a function.

just do
void main (){  LPPOINT lpPoint;  GetCursorPos(lpPoint);  cout << "Mouse position is :"<<lppoint.x<<" "<<lppoint.y;}
Ok you're using it wrong. The more common way to do this is:
POINT ptCursorPos;GetCursorPos( &ptCursorPos );


@snisarenko: that will not work. The function takes a pointer to a POINT structure. At the very least you'd have to access the members using lppoint->x and so on. However, the above sample is more common.
I cant still get it.. I guess im too stupid for win api commands. Can you give example or something? and detailed description.. im sry for bothering you guys heh..
Quote:Original post by aleksi1578
I cant still get it.. I guess im too stupid for win api commands. Can you give example or something? and detailed description.. im sry for bothering you guys heh..


Forget it.. got it now thanks guys :)

This topic is closed to new replies.

Advertisement