Sign in to follow this  
Followers 0
J0ker

Set the icon's image on the title bar

20 posts in this topic

Hi,

Is that possible to set the current icon image of my script(.exe file) on the title of my Gui box without having the image file in the folder? How can I do it?

Posted Image

Thanks!

Share this post


Link to post
Share on other sites



GUISetIcon

Share this post


Link to post
Share on other sites

If I use this command, I MUST have the .ico file in the folder. I want a command that will get the icons from the exe.

Share this post


Link to post
Share on other sites

If I use this command, I MUST have the .ico file in the folder. I want a command that will get the icons from the exe.

What icon are you trying to set it to?

Maybe... http://msdn2.microsoft.com/en-us/library/ms648068.aspx


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

If I use this command, I MUST have the .ico file in the folder. I want a command that will get the icons from the exe.

Then try adding the path to the exe and the exe's icon index number.

eg:

GuiSetIcon("C:\WhatEverDirectory\YourExe\is.exe, 1)

works with dll's , ocx's , cpl's and various other files that have icon resources.

Cheers

Share this post


Link to post
Share on other sites

If you mean your compiled script then use

GuiSetIcon(@AutoItExe, x)

x being the index number of you icon.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Then try adding the path to the exe and the exe's icon index number.

eg:

GuiSetIcon("C:\WhatEverDirectory\YourExe\is.exe, 1)
How can I set it with @SCRIPTDIR if there's not supposed to be any "workingdir" in the parameters.

EDIT:

If you mean your compiled script then use

GuiSetIcon(@AutoItExe, x)

x being the index number of you icon.

I will try this!

How can i know the Index number of my icon?

Edited by J0ker

Share this post


Link to post
Share on other sites

If you want a easy to use gui tool to inject your icons into your compiled upx'd scripts exe then let me know and I'll post my dodgey script I've made for doing the task.

Basicly the script/tool uses reshacker and to inject your icons into an already unedited compiled autoit script.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Using this I'm not getting any image...

GuiCreate("My title", 391, 187,-1, -1, $WS_CAPTION)
GuiSetIcon(@AutoItExe, 1)
GuiSetState()

I tried it compiled.

@smashly: You dont know an other way because I dont really want to use reshacker. The GuiSetIcon should work...

Edited by J0ker

Share this post


Link to post
Share on other sites

Erm..

well, i compile my scripts with the Compile Script to Exe that is included with v3, it has an option to define a custom icon file, i just use that.. and it replaces anywhere that the icon would have shown with the icon i have given it.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Erm..

well, i compile my scripts with the Compile Script to Exe that is included with v3, it has an option to define a custom icon file, i just use that.. and it replaces anywhere that the icon would have shown with the icon i have given it.

huh... I also compiled my script and defined an icon. It's THAT icon image that i want on the title bar of my gui box but without having the .ico file.

Edited by J0ker

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

try it without the $WS_CAPTION

@tAKTelapis

Somtimes ppl want to use more then the 1 icon from their compiled autoit exe, sometimes ppl don't want to use the install function either.

example of what I mean: here

Edited by smashly

Share this post


Link to post
Share on other sites

try it without the $WS_CAPTION

Tried, doesnt work.

Im getting this:

Posted Image

(The Red X is not my image)

Share this post


Link to post
Share on other sites

Add a minus sign to the number.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Tried, doesnt work.

Im getting this:

Posted Image

(The Red X is not my image)

Then it's working as it should.

index 0 is the Autoit icon (first icon in the exe)

index 1 is the cross (this is the second icon in the exe)

index 2 is the white box with a + sign in it (this is the third icon)

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Add a minus sign to the number.

Hurray it work!(without the $WS_CAPTION)

Thx Smash and Smoke!

Edited by J0ker

Share this post


Link to post
Share on other sites

Have a look here for a rough example of how I was using icons from my compiled exe..

Share this post


Link to post
Share on other sites

Hi,

Is that possible to set the current icon image of my script(.exe file) on the title of my Gui box without having the image file in the folder? How can I do it?

Posted Image

Thanks!

As one person said if you are simply just wanting to add a specific icon to left corner of your compiled scripts you can do that with the Compile Script to Exe utility and select the custom ico. Now if you have a regular image that is not a .ico file then it probably won't work. You may need to convert you image to a .ico file and then use the utility to use that image. I have done that before using Photoshop to convert to .ico file. If you don't have PS you can try http://www.coolutils.com/Online-Image-Converter.php and it should convert it for free.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Hi,

Is that possible to set the current icon image of my script(.exe file) on the title of my Gui box without having the image file in the folder? How can I do it?

Try this:

Put your code with icons to folder c:code

put this line to the code after #include lines:

FileInstall("C:\code\icon.ico", "C:\temp\icon.ico")

Now, on wanted place in the code put this:

GUISetIcon ("c:\temp\icon.ico")

Fileinstall() is a way to put all wanted files into compiled script file. It unpacks those "fileinstalled" files to marked place but will not delete them. It has to be done with FileDelete()

I have made some discovering on icon stuff and I think this is only way to make it having only script.exe in folder while run it.

Autoit can't use icon straight from an exe. (Like windows style c:file.exe,1)

Like this:

#include <GUIConstants.au3>

FileInstall("C:\code\icon1.ico", "C:\temp\icon1.ico")
FileInstall("C:\code\icon2.ico", "C:\temp\icon2.ico")
FileInstall("C:\code\icon3.ico", "C:\temp\icon3.ico")
FileInstall("C:\code\icon4.ico", "C:\temp\icon4.ico")

GUICreate ("My test GUI")
GUISetIcon ("c:\temp\icon1.ico")
GUISetState ( )

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Does this help you? :whistle:

Edited by freeman7

-------------------------------------------------------People keeping order at their stuff are just too lazy to search anything...Test these:Easy-to-use notepad

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  
Followers 0