udfHwndToWinId
udfWinIdToHwnd
str udfHwndToWinId (int)
int udfWinIdToHwnd (str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfHwndToWinId (intHwnd)
hdlBB = BinaryAlloc (4)
BinaryPoke4 (hdlBB, 0, intHwnd)
strWinID = "#WIN$ID#" : BinaryPeekHex (hdlBB, 3, 1) : BinaryPeekHex (hdlBB, 2, 1) : BinaryPeekHex (hdlBB, 1, 1) : BinaryPeekHex (hdlBB, 0, 1)
hdlBB = BinaryFree (hdlBB)
Return strWinID
;..........................................................................................................................................
; Hwnd 12453742 <==> "#WIN$ID#00BE076E" WinId
;
; (c)Detlev Dalitz.20100306.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfWinIdToHwnd (strWinId)
hdlBB = BinaryAlloc (4)
BinaryPokeHex (hdlBB, 0, ItemExtract (-1, strWinId, "#"))
intHwnd = (BinaryPeek (hdlBB, 0) << 24) + (BinaryPeek (hdlBB, 1) << 16) + (BinaryPeek (hdlBB, 2) << 8) + BinaryPeek (hdlBB, 3)
hdlBB = BinaryFree (hdlBB)
Return intHwnd
;..........................................................................................................................................
; Hwnd 12453742 <==> "#WIN$ID#00BE076E" WinId
;
; (c)Detlev Dalitz.20100306.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strWinId1 = udfHwndToWinId (DllHwnd ("")) ; #WIN$ID#00BE076E.
strWinId2 = WinIdGet ("")                 ; #WIN$ID#00BE076E.

intHwnd1 = udfWinIdToHwnd (WinIdGet ("")) ; 12453742.
intHwnd2 = DllHwnd ("")                   ; 12453742.

Exit