Jump to content
Sign in to follow this  
randeep

window icon

Recommended Posts

randeep

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]

Share this post


Link to post
Share on other sites
somdcomputerguy

I'm not sure if I can understand correctly, but perhaps this helps? See GUICtrlCreateIcon.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
ProgAndy

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

Share this post


Link to post
Share on other sites
randeep

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]

Share this post


Link to post
Share on other sites
DjDeep00

@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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
ProgAndy

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.