Nessie Posted March 22, 2013 Posted March 22, 2013 Take a look to GUICtrlSetImage function. #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Example() Func Example() Local $msg GUICreate("My GUI") ; will create a dialog box that when displayed is centered GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
ahmeddzcom Posted March 22, 2013 Author Posted March 22, 2013 (edited) On 3/22/2013 at 2:40 AM, 'Nessie said: Take a look to GUICtrlSetImage function. .... tnx Edited March 24, 2013 by ahmeddzcom
Nessie Posted March 22, 2013 Posted March 22, 2013 On 3/22/2013 at 9:09 PM, 'ahmeddzcom said: Not useful .... tnxPlease show me your code and what do you want exactly do Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file
AZJIO Posted March 22, 2013 Posted March 22, 2013 #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Example() Func Example() GUICreate("My GUI") $iCheckbox = GUICtrlCreateCheckbox("-", 10, 105, 40, 40, $BS_PUSHLIKE + $BS_ICON + $BS_FLAT) GUICtrlSetImage(-1, "shell32.dll", 47, 1) GUISetState() While 1 Switch GUIGetMsg() Case $iCheckbox If BitAND(GUICtrlRead($iCheckbox), $GUI_CHECKED) Then GUICtrlSetImage(-1, "shell32.dll", 48, 1) Else GUICtrlSetImage(-1, "shell32.dll", 47, 1) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example My other projects or all
UEZ Posted March 22, 2013 Posted March 22, 2013 (edited) Maybe ahmeddzcom means the icon in the system tray. If mute is checked then system volume should be muted and thus the icon will change. Just a thought... @ahmeddzcom: I suggest that you provide more qualified information. Br, UEZ Edited March 22, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
AZJIO Posted March 23, 2013 Posted March 23, 2013 Already a long time am suffering with this example. Does not work _GUIImageList_ReplaceIcon, _GUIImageList_Swap expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Global $hGui, $hCheckbox, $iCheckbox, $hImage, $k _Main() Func _Main() Local $hImage, $y = 70, $iIcon = 125, $btn[6], $rdo[6], $chk[6], $hImageSmall $hGui = GUICreate("", 510, 400) GUISetState() $hImage = _GUIImageList_Create(32, 32, 5, 3, 6) _GUIImageList_AddIcon($hImage, "shell32.dll", 11, True) ;Обычное _GUIImageList_AddIcon($hImage, "shell32.dll", 6, True) ; Наведение _GUIImageList_AddIcon($hImage, "shell32.dll", 8, True) ; Нажатая _GUIImageList_AddIcon($hImage, "shell32.dll", 9, True) ; Деактивированная _GUIImageList_AddIcon($hImage, "shell32.dll", 6, True) ; Кнопка по умолчанию _GUIImageList_AddIcon($hImage, "shell32.dll", 4, True) ; Stylus Hot (только для планшетных компьютеров) ; $iCheckbox = GUICtrlCreateCheckbox("-", 10, 105, 40, 40, $BS_PUSHLIKE + $BS_ICON + $BS_FLAT) $hCheckbox = _GUICtrlButton_Create($hGUI, "-", 10, 105, 40, 40, $BS_AUTOCHECKBOX + $BS_PUSHLIKE + $BS_ICON + $BS_FLAT) ; $hCheckbox = GUICtrlGetHandle(-1) _GUICtrlButton_SetImageList($hCheckbox, $hImage) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>_Main Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Local $sText = "" Switch $hCtrl Case $hCheckbox Switch $nNotifyCode Case $BN_CLICKED If BitAND(_GUICtrlButton_GetState($hCheckbox), $BST_CHECKED) = $BST_CHECKED Then ; _ReplaceIconButton(@SystemDir & '\shell32.dll', 4, 1) _ReplaceIconButton('shell32.dll', 4, 1) ; _GUIImageList_Swap($hImage, 4, 1) $k += 1 WinSetTitle($hGui, "", 'Checked ' & $k) Else ; _ReplaceIconButton(@SystemDir & '\shell32.dll', 4, 1) _ReplaceIconButton('shell32.dll', 4, 1) ; _GUIImageList_Swap($hImage, 4, 1) $k += 1 WinSetTitle($hGui, "", 'Un Checked ' & $k) EndIf EndSwitch ; Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _ReplaceIconButton($sFile, $iIndex = 0, $iIdxDst = 1) Local $pIcon, $tIcon, $hIcon $tIcon = DllStructCreate("int Icon") ; структура $pIcon = DllStructGetPtr($tIcon) ; указатель структуры $iCount = _WinAPI_ExtractIconEx($sFile, $iIndex, $pIcon, 0, 1) ; извлекает иконку из файла ; MsgBox(0, 'iCount', $iCount) ; If $iCount = 0 Or $iCount > 10000 Then _WinAPI_ExtractIconEx(@SystemDir & '\shell32.dll', 0, 0, $pIcon, 1) $hIcon = DllStructGetData($tIcon, "Icon") ; Получаем дескриптор иконки ; _GUIImageList_ReplaceIcon($hImage, $iIdxDst, $hIcon) ; заменяем единственную иконку ; If Not IsHWnd($hIcon) Then MsgBox(0, $hIcon, 'Not HWnd') If _GUIImageList_ReplaceIcon($hImage, $iIdxDst, $hIcon) = -1 Then MsgBox(0, 'Error', 'Error ReplaceIcon') _WinAPI_DestroyIcon($hIcon) ; удаляем дескриптор _GUICtrlButton_SetImageList($hCheckbox, $hImage) ; устанавливаем иконку на кнопку $tIcon = 0 EndFunc My other projects or all
FireFox Posted March 23, 2013 Posted March 23, 2013 On 3/22/2013 at 1:55 AM, 'ahmeddzcom said: i wantNot useful ....I would completely ignore you since you are asking in an impolite way... but there is still some gentle people here.This is not a "do it for me" forum. You need to show what you've already done by mainly posting a snippet.Br, FireFox. Kyan and ahmeddzcom 2
ahmeddzcom Posted March 24, 2013 Author Posted March 24, 2013 On 3/22/2013 at 10:38 PM, 'AZJIO said: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Example() Func Example() GUICreate("My GUI") $iCheckbox = GUICtrlCreateCheckbox("-", 10, 105, 40, 40, $BS_PUSHLIKE + $BS_ICON + $BS_FLAT) GUICtrlSetImage(-1, "shell32.dll", 47, 1) GUISetState() While 1 Switch GUIGetMsg() Case $iCheckbox If BitAND(GUICtrlRead($iCheckbox), $GUI_CHECKED) Then GUICtrlSetImage(-1, "shell32.dll", 48, 1) Else GUICtrlSetImage(-1, "shell32.dll", 47, 1) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>Example yeeeeees ... tnx Mr.AZJIO .... This is
ahmeddzcom Posted March 24, 2013 Author Posted March 24, 2013 On 3/23/2013 at 2:35 AM, 'FireFox said: Br, FireFox.You have the right ... Thanks for alarm ... was edited
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now