Page 1 of 1
[Implemented] SetClassLongPtr and SetWindowLongPtr api call
Posted: Sun May 01, 2005 1:13 pm
by Rescator
This function supersedes the SetClassLong function. To write code that is compatible with both 32-bit and 64-bit Microsoft Windows, use SetClassLongPtr.
Minimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as ANSI and Unicode versions.
It is identical in use and requirements to SetClassLong,
so Fred could you add this for next PB update of api module/lib?
I know a lot of interface tricks and stuff uses SetClassLong,
but they really should use SetClassLongPtr instead.
Same with SetWindowLong.... SetWindowLongPtr should be used instead!
Note: Info taken straight from MicroSofts XPSP2-SDK!
It's possible that there are even more cases like this.
Re: SetClassLongPtr and SetWindowLongPtr api call is missing
Posted: Sun May 01, 2005 8:35 pm
by Doobrey
Rescator wrote:
It is identical in use and requirements to SetClassLong
If it does exactly the same thing, why does MS see fit to change its name ?
This may sound stupid and bleeding obvious, but do you get the feeling that MS don`t want old software running on their latest OS ?
Posted: Mon May 02, 2005 8:04 am
by blueznl
what's new? they took out part of the thunking functionality in winxp, so 16 bit programs had no longer access to certain 32 bit functions, however they did not take out all functionality, just those that made 16 bit apps look like 32 bit apps (file selectors etc.)
under win2k there was no issue, then suddenly under winxp there is... now there's 64 bits coming up with wow, and 16 will no longer be supported, and 32 bit is, well, waiting for the axe to fall
Posted: Mon May 02, 2005 4:44 pm
by Rescator
I assume that SetClassLong would be under the 32bit emulation layer or 32bit mode,
while SetClassLongPtr is the "native" call.
i.e. on 32bit OS SetClassLongPtr is a 32bit call, while on a 64bit OS it's a 64bit call.
For all I know SetClassLongPtr and SetClassLong are the same on 32bit XP,
but on 64bit XP etc they probably aren't.
So the SetClassLong and SetClassLongPtr makes sense,
as older apps would use SetClassLong and most likely not 64bit comptatible,
while SetClassLongPtr are either 64bit or 32bit (but 64bit compatible).
Altough I do suspect that SetClassLong on a 64bit OS is the native 64bit call,
and will only work if the app is a 64bit app.
Thing is, when I stumbled over this and tried to use SetClassLongPtr and it wasn't in PB's list it kinda set me back for a sec,
as my first thought was. "Damn! So this program won't run on a 64bit windows then".
What surprises me tough is that SetClassLongPtr seems to have existed since Win95,
does this mean that SetClassLong is a remnant from old Win 3.x ?
In which case it kinda makes sense (from MS standpoint)
they'd effectivly prevent 16bit apps from running at all on a 64bit OS.