GetCursorPos works ok but GetPhysicalCursorPos "not declared in this scope"?

1.6k views Asked by At

I'm writing some code (in Codelite), was using GetCursorPos(), no problem. But when I want to call GetPhysicalCursorPos(), it says that it's not declared in this scope...

Same with SetCursorPos working ok but not SetPhysicalCursorPos...

They should both work ok as I included windows.h, don't know what to do...

I tried with importing it from user32.dll but it should not be like that...

Thanks for helping me.

1

There are 1 answers

4
David Heffernan On BEST ANSWER

The GetPhysicalCursorPos API was only added in Vista/Server 2008. So you need to define

#define WINVER 0x0600

before you include the windows header file. More information on that can be found in the MSDN topic: Using the Windows Headers.

The other possibility is that your header files are out of date. Perhaps the compiler you are using does not ship with an up-to-date SDK. If this is the case then you could try a later version of the compiler, a different compiler, or even the official MS supplied SDK.

One thing you should be aware of is that taking a dependency on this API will mean that your program will not run on XP.