change V1 and V2 by clicking, and display the corresponding icon at the same time.
when i click this buttons Change V1.ico or V2.ico
Code: Select all
; Toolbar event handler
OnToolbar(hToolbar, pEvent, pTxt, pPos, pId)
{
global
Critical
if (pPos=2){
IconFile:="C:\Users\Enigma\Desktop\ahkV2.ico"
SwitchAhkVersion(hToolbar, pEvent, pTxt, pPos, pId,IconFile)
} else if pEvent = click
RunTool(pPos)
}
SwitchAhkVersion(hToolbar, pEvent, pTxt, pPos, pId,IconFile){
if pEvent = click
{
hIcon := DllCall("LoadImage", uint, 0, str, IconFile, uint, 1, int, 0, int, 0, uint, LR_LOADFROMFILE:=0x10)
if (!hIcon)
Throw "Icon file missing or invalid in `nChangeWindowIcon(" IconFile ", " WinSpec ")`n`n"
SendMessage, 0x80, 0, hIcon,, ahk_id %hToolbar%
SendMessage, 0x80, 1, hIcon,, ahk_id %hToolbar%
}
}