Ooh, the language will be a thing – are there libraries for them?
Tab doesn’t work properly in pages with a tab control
It’s a bit cryptic, typically one transfers the focus of one control to another control on a form with CTRL-TAB. A tab form or page is itself also a control, thus the user may not expect the change in focus. And, depending on the tab order, the focus could switch to another tab, or a control in another tab, so you’ll want code for the tab to be activated with the contained controls shown, along with the one with the focus. Here’s a little V1 AHK script where CTRL-TAB selects the next tab:
WS_CLIPSIBLINGS := 0x4000000
DetectHiddenWindows, On
Gui, +LastFound -MaximizeBox -MinimizeBox +OwnDialogs HWNDguihWnd
thisguiW := floor(A_ScreenWidth/2)
thisguiH := floor(A_ScreenHeight/6)Gui, Add, Text, vText Center x0 y0, Tab1
GuiControl, Move, Text, % “x” thisguiW/3 “y” thisguiH/3Gui, Add, Tab2, x0 y0 w%thisguiW% h%thisguiH% vTestTab gTestTab HWNDtestTabhWnd, Tab1|Tab2|Tab3
Gui, Show, w%thisguiW% h%thisguiH% Hide
; Calling GetNonClientDim with testTabhWnd is useless
tabguiH := thisguiH – GetNonClientDim(guihWnd)
tabguiW := thisguiW – A_LastErrortmp := A_ScriptDir . “\” . “logo.png”
urlDownloadToFile(“https://stearnvault.com/wp-content/uploads/2025/04/logo.png”, tmp, “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.45”)sleep 120
loop, 3
{
Gui, Tab, %A_Index%
picH := LoadPicture(tmp, GDI+ w%tabguiW% h%tabguiH%)
if (picH)
{
Gui, Add, Picture, x0 y0 w%tabguiW% h%tabguiH% glogo %WS_CLIPSIBLINGS%, % “HBITMAP:*” picH
gosub logo
}
}ControlGetPos,,, w, h, Static2, , % “HBITMAP:*” picH
msgbox % “Pic width ” w ” Pic height ” h “
nthisgui width " thisguiW " thisgui height " thisguiH "ntabgui width ” tabguiW ” tabgui height ” tabguiHGui, Show, w%thisguiW% h%thisguiH%, Test
return
TestTab:
GuiControlGet, tmp, , TestTab
GuiControl, , Text, %tmp%
Return
logo:
GuiControl, Move, % “HBITMAP:*” picH, % “x” 0 “y” (thisguiH – tabguiH) “w” tabguiW “h” tabguiH
Return
Esc::
GuiClose:
filerecycle %tmp%
ExitAppGetNonClientDim(Hwnd)
{
If WinExist(“ahk_id ” Hwnd)
{
VarSetCapacity(rect, 16, 0)
DllCall(“GetWindowRect”, “Ptr”, Hwnd, “Ptr”, &rect)
W := NumGet(rect, 8, “int”) – NumGet(rect, 0, “int”)
H := NumGet(rect, 12, “int”) – NumGet(rect, 4, “int”)
VarSetCapacity(rect, 16, 0)
DllCall(“GetClientRect”, “Ptr”, Hwnd, “Ptr”, &rect)
W := W – NumGet(rect, 8, “int”)
DllCall(“SetLastError”, “UInt”, W)
Return H – NumGet(rect, 12, “int”)
}
else
msgbox Problem with Tab!
}
/* Written by Masonjar13Downloads a file from a URL to a local file.
Parameters:
—————
url: url to download fromfileDest (optonal): local path to save to (defaults to script
folder with name of file from the url)userAgent (optional): a valid useragent string to be used during
the http requestreturn: caught error message
—————Example:
————
urlDownloadToFile(“https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png”)
————*/
urlDownloadToFile(url,fileDest:=””,userAgent:=””){
if (!fileDest) {
splitPath,url,fileDest
fileDest:=a_scriptDir “\” fileDest
}
if (!regExMatch(url,”i)https?://”))
url:=”https://” url
try {
hObject:=ComObjCreate(“WinHttp.WinHttpRequest.5.1”)
;hObject:=ComObjCreate(“Msxml2.XMLHTTP”) not reliable
hObject.Option(9) := 0X0800
;Msxml2.XMLHTTP
;hObject.AddRequestHeaders($hRequest, “Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9”)
;hObject.SetRequestHeader(“Pragma”, “no-cache”)
;hObject.SetRequestHeader(“Cache-Control”, “no-cache, no-store”)
;hObject.SetRequestHeader(“If-Modified-Since”, “Sat, 1 Jan 2000 00:00:00 GMT”)
hObject.SetTimeouts(0,30000,30000,120000)
hObject.open(“GET”,url)
if (userAgent)
hObject.setRequestHeader(“User-Agent”,userAgent)
hObject.send()uBytes:=hObject.responseBody,cLen:=uBytes.maxIndex()
fileHandle:=fileOpen(fileDest,”w”)
varSetCapacity(f,cLen,0)
loop % cLen+1
numPut(uBytes[a_index-1],f,a_index-1,”UChar”)
err:=fileHandle.rawWrite(f,cLen+1)
} catch e
return % e.message
}
The AHK logo is now stored here, ever since a rather stricter regime of Cloudflare settings has taken hold over there. 🙁
Ehm, anyway, back to C++. 😛
