Hello
How i can translate the MAKEPOINTS macro (WinAPI) to Purebasic?
Thank you
Nico
How i can Translate MAKEPOINTS macro to PB?
Something like this?
[edit] Can someone else confirm if this is right, im a bit drunk and i think im getting my hi/loword mixed up! hic...hic... 
Code: Select all
DWORD_CONTAINING_COORDS.l = %00000100000000000000001100000000
Procedure.l MakePoints(Value.l)
Static Coords.POINT
Coords\x = Value & $FFFF
Coords\y = (Value >> 16) & $FFFF
ProcedureReturn @Coords
EndProcedure
*POINTS_STRUCTURE = MakePoints(DWORD_CONTAINING_COORDS)
XPos.l = PeekW(*POINTS_STRUCTURE + 4)
YPos.l = PeekW(*POINTS_STRUCTURE)
Debug XPos
Debug YPos

i would say is
you don't need the extra '&' to get the high word part
Code: Select all
Procedure.l MakePoints(Value.l)
Static Coords.POINT
Coords\x = Value & $FFFF
Coords\y = Value >> 16
ProcedureReturn @Coords
EndProcedure
I would say that you need the extra '&' because PB uses arithmetic shift so if bit 32 is set 1:s are shifted in from the left. Just try your procedure with a negative number and see..Justin wrote:i would say is
you don't need the extra '&' to get the high word partCode: Select all
Procedure.l MakePoints(Value.l) Static Coords.POINT Coords\x = Value & $FFFF Coords\y = Value >> 16 ProcedureReturn @Coords EndProcedure