Skip to content

Instantly share code, notes, and snippets.

@CarlTBarnes
Last active April 14, 2024 21:42
Show Gist options
  • Save CarlTBarnes/d2248102dc06873df577f31ad3db1be8 to your computer and use it in GitHub Desktop.
Save CarlTBarnes/d2248102dc06873df577f31ad3db1be8 to your computer and use it in GitHub Desktop.
GetWindowLong() then SetWindowLong() applying an OFF and ON Bitmask
MAP
GetSetWindowLongFEQ_GWL_Style Procedure(LONG ControlFEQ, LONG BitsOFF, LONG BitsON) ,LONG,PROC
GetSetWindowLongFEQ_GWL_ExStyle Procedure(LONG ControlFEQ, LONG BitsOFF, LONG BitsON) ,LONG,PROC
GetSetWindowLongFEQ Procedure(LONG ControlFEQ, LONG WLnIndex, LONG BitsOFF, LONG BitsON) ,LONG,PROC
GetSetWindowLongHnd Procedure(LONG WndHandle, LONG WLnIndex, LONG BitsOFF, LONG BitsON) ,LONG,PROC
module('win32')
GetWindowLong(SIGNED hWnd, SIGNED nIndex ),PASCAL,RAW,LONG,PROC,NAME('GetWindowLongA'),DLL(1)
SetWindowLong(SIGNED hWnd, SIGNED nIndex, LONG dwNewLong ),PASCAL,RAW,LONG,PROC,NAME('SetWindowLongA'),DLL(1)
end
END
!==========================================================================================
GetSetWindowLongFEQ_GWL_Style Procedure(LONG FEQ, LONG BitsOFF, LONG BitsON) !,LONG,PROC
eGWL_Style EQUATE(-16)
CODE
RETURN GetSetWindowLongHnd(FEQ{PROP:Handle}, eGWL_Style, BitsOFF, BitsON)
GetSetWindowLongFEQ_GWL_ExStyle Procedure(LONG FEQ, LONG BitsOFF, LONG BitsON) !,LONG,PROC
eGWL_ExStyle EQUATE(-20)
CODE
RETURN GetSetWindowLongHnd(FEQ{PROP:Handle}, eGWL_ExStyle, BitsOFF, BitsON)
GetSetWindowLongFEQ Procedure(LONG FEQ, LONG WLnIndex, LONG BitsOFF, LONG BitsON) !,LONG,PROC
CODE
RETURN GetSetWindowLongHnd(FEQ{PROP:Handle}, WLnIndex, BitsOFF, BitsON)
GetSetWindowLongHnd Procedure(LONG WndHandle, LONG WLnIndex, LONG BitsOFF, LONG BitsON) !,LONG,PROC
WL LONG,AUTO
CODE
WL=GetWindowLong(WndHandle, WLnIndex)
WL=BAND(WL, BXOR(-1,BitsOFF)) !Classic Boolean "Not And" or NAND()
WL= BOR(WL, BitsON)
SetWindowLong(WndHandle, WLnIndex, WL)
RETURN WL
!Jeff's way to Turn Off Bits: WL=BXOR(WL,(BAND(WL,BitsOFF)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment