Author Topic: Get/Set Class/Window LongPtr Functions Missing  (Read 3550 times)

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Get/Set Class/Window LongPtr Functions Missing
« on: October 08, 2012, 04:22:09 AM »
GetClassLongPtr
GetWindowLongPtr
SetClassLongPtr
SetWindowLongPtr

missing from user32.inc

i know - they are probably "aliases" for Get/Set Class/Window Long functions on 32-bit OS's
but - it would be nice to have them   :P

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: Get/Set Class/Window LongPtr Functions Missing
« Reply #1 on: October 08, 2012, 04:39:10 AM »
ok - my mistake
they do not show up in my version of user32.dll (xp sp3)

i was going by the MSDN documentation...
Quote
Note: To write code that is compatible with both 32-bit and 64-bit versions of Windows,
use GetClassLongPtr. When compiling for 32-bit Windows, GetClassLongPtr is defined
as a call to the GetClassLong function.

i suppose you could make that happen with some TEXTEQU's

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Re: Get/Set Class/Window LongPtr Functions Missing
« Reply #2 on: October 08, 2012, 04:58:14 AM »
Quote
IFDEF _WIN64
;API
GetClassLongPtrA PROTO :DWORD ,:DWORD
;API
GetClassLongPtrW PROTO :DWORD ,:DWORD
IFDEF UNICODE
GetClassLongPtr   equ   < GetClassLongPtrW>
ELSE
GetClassLongPtr   equ   < GetClassLongPtrA>
ENDIF ; !UNICODE
and .....

Quote
IFDEF UNICODE
SetClassLongPtr   equ   < SetClassLongPtrW>
ELSE
SetClassLongPtr   equ   < SetClassLongPtrA>
ENDIF ; !UNICODE
ELSE
GetClassLongPtrA   equ   < GetClassLongA>
GetClassLongPtrW   equ   < GetClassLongW>
IFDEF UNICODE
GetClassLongPtr   equ   < GetClassLongPtrW>
ELSE
GetClassLongPtr   equ   < GetClassLongPtrA>
ENDIF ; !UNICODE

Just replace the call to GetClassLongPtr by GetClassLong
And if the future of your code is to be build under 64 bits ,you are ready.
Use the "ready to use sdk" for this,citations are extract for him.






Fa is a musical note to play with CL

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: Get/Set Class/Window LongPtr Functions Missing
« Reply #3 on: October 08, 2012, 10:33:38 AM »
In the Microsoft WinUser.h, unless _WIN64 is defined the …LongPtr function names are effectively equated to the older functions:
Code: [Select]
#define GetClassLongPtrA    GetClassLongA
#define GetClassLongPtrW    GetClassLongW
Well Microsoft, here’s another nice mess you’ve gotten us into.