plz help me convert V1 code to V2 Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
viv
Posts: 217
Joined: 09 Dec 2020, 17:48

plz help me convert V1 code to V2

Post by viv » 22 Feb 2021, 04:45

My script use a function by
https://www.autohotkey.com/boards/viewtopic.php?t=60866

Now I ready to switch to V2
but have some problem
this one
I need to convert this function to v2
and I dont learn DllCall (so...May require complete code)
Thank you all for your help

Code: Select all

HideShowTaskbar(action) {
   static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
   VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
   NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
   NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
   DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: plz help me convert V1 code to V2  Topic is solved

Post by swagfag » 23 Feb 2021, 19:53

Code: Select all

HideShowTaskbar(shouldHide) {
	static size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize
	APPBARDATA := BufferAlloc(size, 0)
	NumPut('UInt', size, APPBARDATA)
	NumPut('Ptr', WinExist('ahk_class Shell_TrayWnd'), APPBARDATA, A_PtrSize)
	
	static ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
	NumPut('Ptr', shouldHide ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)

	static ABM_SETSTATE := 0xA
	DllCall('Shell32\SHAppBarMessage', 'UInt', ABM_SETSTATE, 'Ptr', APPBARDATA, 'Ptr')
}

User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: plz help me convert V1 code to V2

Post by lmstearn » 25 Jul 2021, 08:56

Just a heads up, BufferAlloc is now replaced by the Buffer Object.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

Post Reply

Return to “Ask for Help (v2)”