Jump to content

window icon


Recommended Posts

hello all

pls see this. is there any possibility to place the an icon just before heading of the second window through AutoIt (Just like the Styled AutoIt "A" icon (Blue) at the address bar)?????

(not able to upload the images)

thanx in advance

Edited by randeep

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

Or do you want GUISetIcon?

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

actually i am trying to place icons of '.ico' format, just before the heading of the GUI at the blue strip(created with GuiCreate).

E.G. when you click C:\ on you computer, then C:\ drive window opens, just see the leftmost top of the window, a harddisk icon is there, just before heading in the blue strip. (i think i am not able to explain better then this. :D )

http://images.google.co.in/imgres?imgurl=h...sa%3DN%26um%3D1

pls follow the link to see '.ico' format.

thanx

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

@randeep...

ProgAndy is correct you need to use Guiseticon() like this...

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg

    GUICreate("My GUI new icon") ; will create a dialog box that when displayed is centered

    GUISetIcon("shell32.dll",-20) ; will change icon

    GUISetState(); will display an empty dialog box

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example
Link to comment
Share on other sites

You can even complicate that and do it this way:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg

    Local $hGui = GUICreate("My GUI new icon"); will create a dialog box that when displayed is centered

;GUISetIcon("shell32.dll", -20); will change icon
    _GUISetIcon($hGui, "shell32.dll", 20); name and not ordinal value

    GUISetState(); will display an empty dialog box

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example




Func _GUISetIcon($hGui, $sModule, $iName); this for loaded modules in this shape

    Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", $sModule)

    Local $hModule = $a_hCall[0]

    $a_hCall = DllCall("user32.dll", "hwnd", "LoadImageW", _
            "hwnd", $hModule, _
            "int", $iName, _
            "dword", 1, _; IMAGE_ICON
            "int", 32, _
            "int", 32, _
            "dword", 0); LR_DEFAULTCOLOR

    Local $hIcon = $a_hCall[0]

    DllCall("user32.dll", "hwnd", "SendMessageW", _
            "hwnd", $hGui, _
            "dword", 0x0080, _; WM_SETICON
            "dword", 1, _; 1 = ICON_BIG, 0 = ICON_SMALL
            "hwnd", $hIcon)

EndFunc  ;==>_GUISetIcon

Why would you do that? Because it will change ALT-TAB icon as well (built-in function forgets that)

Btw, DjDeep00 advices randeep... that's deep, Muad'Dib :D

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

There is also an other way to to it :D Set with GUISetIcon and then set "small" icon to "large" icon with Sendmessage.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg

    Local $hGui = GUICreate("My GUI new icon"); will create a dialog box that when displayed is centered

;GUISetIcon("shell32.dll", -20); will change icon
    _GUISetIcon($hGui, "shell32.dll", 20); name and not ordinal value

    GUISetState(); will display an empty dialog box

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example




Func _GUISetIcon($hGui, $sModule, $iName); this for loaded modules in this shape

    GUISetIcon($sModule, $iName, $hGui)

    Local $a_hCall = DllCall("user32.dll", "lresult", "SendMessageW", _
            "hwnd", $hGui, _
            "dword", 0x007F, _; WM_GETICON
            "wparam", 0, _; 1 = ICON_BIG, 0 = ICON_SMALL
            "lparam", 0)
    DllCall("user32.dll", "lresult", "SendMessageW", _
            "hwnd", $hGui, _
            "dword", 0x0080, _; WM_SETICON
            "wparam", 1, _; 1 = ICON_BIG, 0 = ICON_SMALL
            "lparam", $a_hCall[0])

EndFunc  ;==>_GUISetIcon

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

There is also an other way to to it :D Set with GUISetIcon and then set "small" icon to "large" icon with Sendmessage.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg

    Local $hGui = GUICreate("My GUI new icon"); will create a dialog box that when displayed is centered

;GUISetIcon("shell32.dll", -20); will change icon
    _GUISetIcon($hGui, "shell32.dll", 20); name and not ordinal value

    GUISetState(); will display an empty dialog box

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>Example




Func _GUISetIcon($hGui, $sModule, $iName); this for loaded modules in this shape

    GUISetIcon($sModule, $iName, $hGui)

    Local $a_hCall = DllCall("user32.dll", "lresult", "SendMessageW", _
            "hwnd", $hGui, _
            "dword", 0x007F, _; WM_GETICON
            "wparam", 0, _; 1 = ICON_BIG, 0 = ICON_SMALL
            "lparam", 0)
    DllCall("user32.dll", "lresult", "SendMessageW", _
            "hwnd", $hGui, _
            "dword", 0x0080, _; WM_SETICON
            "wparam", 1, _; 1 = ICON_BIG, 0 = ICON_SMALL
            "lparam", $a_hCall[0])

EndFunc  ;==>_GUISetIcon
Yes, yes.

That way is having problem with ALT-TAB icon size/resolution though. It's enlarged 16x16 with all that comes with that.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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