SDK Issue - GetWindowLongPtr Undeclared
-
Saturday, October 24, 2009 2:45 AMHi
I'm using the examples of the Programming Application For Windows By Jeffery Richter.
I'm using Microsoft Visual Studio 6.0.
It gives the following errors.
You are not using the latest Platform SDK header/library
files. This may prevent the project from building correctly.
error C2065: 'GetWindowLongPtr' : undeclared identifier
error C2065: 'GWLP_HINSTANCE' : undeclared identifier
error C2501: 'PCTSTR' : missing storage-class or type specifiers
I have installed SDK for http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
This Windows Server 2003 Platform SDK.After installation i have included the Executable,Libarary and Include directories in the visual studio. But no use.
Still I'm getting the same errors.
Can somebody help me how to overcome this.
Which SDK has to be downloaded & installed?
Answers
-
Saturday, October 24, 2009 1:55 PMModerator
VC6 is old, 11 years is a lifetime in software development. GetWindowLongPtr() was introduced in the Win32 API well after VC6 (and the SDK headers it has) was released. It was necessary to support the 64-bit version of Windows, GetWindowLong() cannot return 8 byte pointer values.
You are liable to run into many other problems like this. The compiler itself has seen many updates since VC6 to make it C++ standard compliant. It has an I/O stream implementation that's desperately obsolete. Etcetera. You can get the current version of the compiler for free, download the VS2008 Express edition. Recommended.
Hans Passant.- Marked As Answer by Wesley Yao Friday, October 30, 2009 3:02 AM
All Replies
-
Saturday, October 24, 2009 7:01 AMHello Syed,
>> error C2501: 'PCTSTR' : missing storage-class or type specifiers
Make sure you have included windows.h.
BTW, take "Include directories" from tools > options menu and move the latest platform SDK include paths to top.
Hopefully it will solve the problem. If not, please don't hesitate to post the code.
Best Regards,
Jijo.
http://weseetips.com[^] Visual C++ tips and tricks. Updated daily. -
Saturday, October 24, 2009 11:18 AMHi Raj,
"Include directories" from tools > options menu and move the latest platform SDK include paths to top.
----------------------------------------------------------------------------------------------------------------------
Hopefully it will solve the problem. If not, please don't hesitate to post the code.
-------------------------------------------------------------------------------------------
I did this and its working fine.Thanks for your help raj.
Can anybody tell what was the problem? Really i didnt get. -
Saturday, October 24, 2009 1:55 PMModerator
VC6 is old, 11 years is a lifetime in software development. GetWindowLongPtr() was introduced in the Win32 API well after VC6 (and the SDK headers it has) was released. It was necessary to support the 64-bit version of Windows, GetWindowLong() cannot return 8 byte pointer values.
You are liable to run into many other problems like this. The compiler itself has seen many updates since VC6 to make it C++ standard compliant. It has an I/O stream implementation that's desperately obsolete. Etcetera. You can get the current version of the compiler for free, download the VS2008 Express edition. Recommended.
Hans Passant.- Marked As Answer by Wesley Yao Friday, October 30, 2009 3:02 AM

