Jump to content

Change Icon in taskbar of a MsgBox


fctd
 Share

Recommended Posts

Hello,

Can't find anything to change the icon in the taskbar, when starting the script with a MsgBox.

Does someone have an idea?

Thanks.

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

Is TraySetIcon() what you are looking for?

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Just doing that. The TrayIcon is displayed well.

Not the Taskbar icon while running a MsgBox.

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

So you mean the icon of the msgbox itself? (not meaning the Warning sign or Exclamation etc.. on the msgbox)

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

I don't have an icon in the MsgBox yet.

I mean the icon under in the "taskbar" from windows, where the opened applications are shown.

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

When you compile the script and give it an icon (CTRL+F7 in SciTE) it will use that icon for the msgbox in the taskbar.

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

How can I add an icon?

I build it in SciTE.

; First Run
;==============================================
Func OnAutoItStart ()
    ; === Set Tray Icon ===
    TraySetIcon("C:\Program Files\Windows Media Player\wmplayer.exe")
    ; === Reset auto Pauze in tray ===
    Opt("TrayAutoPause", 0) 
EndFunc 

; === Show MessageBox ===
MsgBox(4096,"<= Wrong Icon", "In the MsgBox is not the right icon" & @CRLF & "Also under in the taskbar of windows, i need an other icon")

With this script, I get a Windows mediaplayer icon in the tray, but still not in the Taskbar or MsgBox.

:)

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

In SciTE got to the Tools menu and click on Compile (or press CTRL+F7 like I told you before). This pops up some advanced compile options. There is one for "Icon", you just need to point it at a .ico file to use that icon.

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

I don't get a pop-up !

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

OK, try saving your script (as a .au3). Then open up "My Computer" browse to wherever you saved the file, right click on it and choose "Compile with options".

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Only choice is "Compile".

Can't find "Compile with options".

*Edit* Is Scite Lite the problem ?

Edited by fctd

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

Hmmm.... OK, try

Start | Programs | AutoIt v3 | Compile Script to .exe

slightly different but should have the same effect for you... if you don't have that... I'm out of ideas for you buddy :)

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

:) SciteLite is the problem ! :lmao:

Sorry for disturbing.

Greetings.

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

SpookMeister,

Compiling with an icon, changes only the icon of the .exe file.

When I start the MsgBox, still have the AutoIt icon in the taskbar.

*EDIT* :lmao: Was pointing to a .exe file in stead of a .ico, now it works fine.

Don't have an icon in the MsgBox yet, :) working on that.

Thanks.

Edited by fctd

[list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]

Link to comment
Share on other sites

  • 3 months later...

SpookMeister,

Compiling with an icon, changes only the icon of the .exe file.

When I start the MsgBox, still have the AutoIt icon in the taskbar.

*EDIT* ;) Was pointing to a .exe file in stead of a .ico, now it works fine.

Don't have an icon in the MsgBox yet, ^_^ working on that.

Thanks.

Did you ever figure out how to change the icon of a msgbox on the taskbar? I'm compiling it with an ico which does change it for the .exe file, but when I pop up a msgbox it's still the AutoIT default icon in the taskbar.

Link to comment
Share on other sites

SpookMeister,

Compiling with an icon, changes only the icon of the .exe file.

When I start the MsgBox, still have the AutoIt icon in the taskbar.

*EDIT* ;) Was pointing to a .exe file in stead of a .ico, now it works fine.

Don't have an icon in the MsgBox yet, ^_^ working on that.

Thanks.

I saw some strange things depending on what ico I specified during compile. I used the ScriptPackager.ico from PrimalScript and it changed the msgbox's taskbar icon as well. I thought OK all is good. However, when I removed the ico file and recompiled it, the msgbox's taskbar icon was still the ScriptPackager.ico. Very strange stuff. Then when I tried to use the original ico that I wanted it would never change the msgbox icon after compiling with that ico. Seems like some strange issues with Aut2Exe.

Link to comment
Share on other sites

  • Moderators

Cyri,

I have had the same problem in the past. It is the Windows icon cache that is remembering the previous icon - it is not a problem with Aut2Exe. Google for how to refresh the icon cache on your OS and you should then get the correct icon displayed.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Cyri,

I have had the same problem in the past. It is the Windows icon cache that is remembering the previous icon - it is not a problem with Aut2Exe. Google for how to refresh the icon cache on your OS and you should then get the correct icon displayed.

M23

Thanks for the tip. I've had to rebuild the icon cache once or twice before when it was corrupted. As a workaround, I ended up using something like this:

$hWnd = GUICreate("")
MsgBox(4096, "test", "testing the msgbox icon", 0, $hWnd)

In my case I really didn't care about the icon so much but rather hiding msgbox from showing in the taskbar at all. Even using the system modal as shown above nothing gets displayed on the taskbar. I'm guessing this is because I never show the parent GUI. Perhaps there are better ways, but this worked for me.

Link to comment
Share on other sites

  • 5 years later...

Maybe the function _MsgBox() below can serve the purpose, it creates a GUI with the desired icon, associating the MsgBox as child. To see the example, the code must be compiled.

Example()

Func _MsgBox($flag, $title, $text, $timeout = "", $icofile = "")
    Local $hwnd, $out
    $hwnd = GUICreate("", 0, 0, -1, -1, 0, 0, 0)
    GUISetIcon($icofile)
    GUISetState(@SW_SHOWMINIMIZED)
    $msg = MsgBox($flag, $title, $text, $timeout, $hwnd)
    GUIDelete($hwnd)
    Return $msg
EndFunc

Func Example()
    ; Example (works only if compiled)
    If Not @Compiled Then
        _MsgBox(16,"Error", "Compile the script to see the examples")
        Exit
    EndIf
    Local $icofile1 = @SystemDir & "\regedit.exe"
    Local $icofile2 = @SystemDir & "\notepad.exe"
    Local $icofile3 = @SystemDir & "\explorer.exe"
    Local $button
    While 1
        $button = _MsgBox(3+48, "_MsgBox", "This is a MsgBox with customized icon in the taskbar. Look to the icon, it's from Regedit.exe. Click YES to Notepad.exe icon or NO to Explorer.exe icon, or CANCEL to exit.", "", $icofile1)
        If  $button == 6 Then
            _MsgBox(64, "_MsgBox", "You clicked on YES. Look to the icon in taskbar, it's now from Notepad.exe", 10, $icofile2)
        ElseIf $button == 7 Then
            _MsgBox(64, "_MsgBox", "You clicked on NO. Look to the icon in taskbar, it's now from Explorer.exe", 10, $icofile3)
        Else
            Exit
        EndIf
    WEnd
EndFunc
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...