Page 1 of 1
About changing the icon of executable generated file.
Posted: Tue Sep 13, 2011 2:54 pm
by takis76
Hello
I would like to ask , when I compile my executable file of my game(s) , how I would able to change the icon of the .exe file and put something else than the default one?
Thank you.
Re: About changing the icon of executable generated file.
Posted: Tue Sep 13, 2011 3:00 pm
by MachineCode
Compiler menu -> Compiler Options.
Re: About changing the icon of executable generated file.
Posted: Tue Sep 13, 2011 3:05 pm
by Zach
It is located under Compiler Options. I am assuming if you assign an icon without and open project, it will be the default for any compiled EXE, but if you open compiler options while you have a project open, it should use the icon unique to that project. You can tell if you have a project open and are doing it properly, if you get an additional side panel that lists your Compile targets (the default for any project will be listed as Debug)
Or maybe it has no bearing on the project currently open? I'm not sure. In either case here is a picture of what you need.

Re: About changing the icon of executable generated file.
Posted: Tue Sep 13, 2011 6:19 pm
by takis76
Thank you very very much.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 8:28 am
by TI-994A
MachineCode wrote:Compiler menu -> Compiler Options.
Sorry to bump this thread, but could this setting be done programmatically?
Also, this setting reverses the following code, which suppresses the icon:
Code: Select all
wFlags = #WS_OVERLAPPEDWINDOW | #WS_VISIBLE | 1
OpenWindow(1, 0, 0, 300, 200, "No Window Icon", wFlags)
SetWindowLong_(WindowID(1), #GWL_EXSTYLE, #WS_EX_DLGMODALFRAME)
HideWindow(1, 0)
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Should we assume that it would not be possible to have a window with no icon if we set the EXE icon?
Thank you.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 9:12 am
by takis76
Yes the fullscreen window don't have any icon.
If the game is in window it will have icon.
But yet changing the application .exe file icon.
I will test this, thank you very very much.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 9:23 am
by Bisonte
TI-994A wrote:Should we assume that it would not be possible to have a window with no icon if we set the EXE icon?
You mean something like that ?
Code: Select all
; directly from RSBasic's WinAPI Library
If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SendMessage_(WindowID(0),#WM_SETICON,#False,5)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
or use this
Code: Select all
Procedure SetWindowIcon(Window, Image) ; Set a new window icon
If IsWindow(Window) And IsImage(Image)
SendMessage_(WindowID(Window),#WM_SETICON,#False,ImageID(Image))
EndIf
EndProcedure
So I can set an icon by compiler options and have a window with no - icon... or have I something misunderstood ?
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 9:42 am
by TI-994A
Bisonte wrote:So I can set an icon by compiler options and have a window with no - icon... or have I something misunderstood ?
Hi Bisonte. Thank you for the examples
(both of them show icons in the window). Setting the icon for the window is not a problem. I was trying to find a way to set the icon of the compiled executable (the EXE file) as it appears in the Windows Explorer
by code. Currently, this is done using PureBasic's Compiler Menu --> Compiler Options --> Use Icon.
Furthermore. if we do not want to have any icon in the window, this compiler "Use Icon" setting will override the #WS_EX_DLGMODALFRAME setting.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 5:19 pm
by TI-994A
Looks like too many questions confusing the main issue, so I'll just summarise:
Is there any way, using code, to set the icon for the compiled executable? (not the window)
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 8:01 pm
by Primoz128
Use a program from google for that, it's very simple.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 10:54 pm
by MachineCode
A commandline switch to set the icon's executable would be good.
Re: About changing the icon of executable generated file.
Posted: Wed Oct 10, 2012 10:57 pm
by takis76
There are some icon changer programs which do this, but sometimes icon changers will mess up all your applications icons.
I think, when you compile your program, PureBasic changes the main icon of your application. I don't thing there is a problem about the .exe file icon.
I had posted this and
Zach answered my question.
