1

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
jj.jpnt
  • 199
  • 1
  • 12
  • 1
    What are these functions? These are not standard C++ library functions so you must mention the library or framework you are using. – Alok Save Dec 04 '13 at 16:22
  • Should be ok just including windows.h said msdn... Windows API http://msdn.microsoft.com/en-us/library/windows/desktop/aa969464(v=vs.85).aspx – jj.jpnt Dec 04 '13 at 16:49

1 Answers1

2

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Thanks, I just tried, even tried more recents WINVER NTDDI_VERSION _WIN32_WINNT, no success (thanks for the info by the way)... I should mention I'm using g++ under codelite... Maybe another define ? Searched but no success... – jj.jpnt Dec 04 '13 at 16:53
  • I manually searched in the headers, did find GetCursorPos but no Physical... So I guess you're right it should be my headers that are outdated... strange, I got VS2012 so sdk shouldn't be old... think Codelite doesn't pick the right one. Will check thanks a lot. – jj.jpnt Dec 04 '13 at 17:00
  • I think my answer is accurate. The declarations in `WinUser.h` in the MS SDK which is where the functions are declared have `#if(WINVER >= 0x0600)` around them. So I guess you must be seeing an old SDK. – David Heffernan Dec 04 '13 at 17:03
  • I'm sure of it, so I checked your answer as correct. Thanks a lot David. – jj.jpnt Dec 04 '13 at 17:19