Jump to content

Recommended Posts

Posted

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

Posted

  On 3/22/2013 at 9:09 PM, 'ahmeddzcom said:

Not useful .... tnx

Please 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

Posted

#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

Posted (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 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

Already a long time am suffering with this example.

Does not work _GUIImageList_ReplaceIcon, _GUIImageList_Swap

#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
Posted

  On 3/22/2013 at 1:55 AM, 'ahmeddzcom said:

i want

Not 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.

Posted

  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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...