I attempted to use your example by plugging in a couple of the Cases, but it doesn't cycle past the first one. I know that your example goes well beyond the 4 Cases I had to begin with so I'm confident all my problem comes after your clever use of the soundbeep. I just don't see it or lack the comprehension at this point.
And I think I understand what you mean by building the Gui at the start of the script, but I have no idea how I would do that while including the DLL calls.
Any chance you can stitch together the 2 Case examples I have below? As you can see, I attempted to blow up
(spread out) the first case trying to figure it out.
Code: Select all
#SingleInstance, Force
#Persistent
max := 25
^T::
n := n++ - max ? n : 1
SoundBeep 1350 + 50 * n
Switch n {
Case 1:
DllPath := "C:\WINDOWS\SYSTEM32\accessibilitycpl.dll" ; ACCESSIBILITYCPL.DLL
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
; DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8) ; ←←← HOW TO INCLUDE IN GUI? ←←←
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, ACCESSIBILITYCPL.DLL
; DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0) ; ←←← HOW TO INCLUDE IN GUI? ←←←
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
; Return
Case 2:
DllPath := "C:\WINDOWS\SYSTEM32\compstui.dll" ; COMPSTUI.DLL
Gui, Margin, 0, 0
Gui, +AlwaysOnTop -MinimizeBox -DPIScale +hwndGuiHwnd
DllCall("uxtheme\SetWindowThemeAttribute", "ptr", GuiHwnd, "int", 1, "int64*", 6 | 6<<32, "uint", 8)
Gui, Add, Button, w300 h50 gIconSizeToggle +Center, Toggle Icon Size
Gui, Add, ListView, w300 h550 vListView +hwndListViewHwnd -0x4000 +LV0x10000 +0x8000, COMPSTUI.DLL
Gui, Add, ListView, w300 h550 , COMPSTUI.DLL
DllCall("UxTheme.dll\SetWindowTheme", "Ptr", ListViewHwnd, "WStr", "Explorer", "Ptr", 0)
LV_ModifyCol(1,279)
GoSub, IconSizeToggle
Gui Show, h600 w300, Dll icons
; Return
}
; ╞════════════════ ICON SIZE TOGGLE ═══════════════╡
IconSizeToggle:
IconSize := !IconSize
GuiControl, -Redraw, ListView
LV_Delete()
if (IconSize)
ImageListID := IL_Create(1, 1, 1)
else
ImageListID := IL_Create()
LV_SetImageList(ImageListID, 1) ; Assign the above ImageList to the current ListView.
Loop { ; Populate the listview
Check := IL_Add(ImageListID, DllPath, A_Index)
if (Check != 0) {
LV_Add("Icon" . A_Index, A_Index)
}
else
Break
}
GuiControl, +Redraw, ListView
Return
Also, I get this error when running this as is. But the original way that I was able to cycle through the 1st for Cases it worked correctly, as in going through each Case with no error. Just wouldn't go beyond the 4 Cases.
I really don't understand that since it's almost exactly the same thing, at least to my untrained eye. Thank you very much for all your help thus far!!
- image.png (26.27 KiB) Viewed 939 times