Executable Icon
BlitzMax Forums/BlitzMax Programming/Executable Icon
| ||
How do I compile my project (on Windows) so that the output executable has an embedded icon? |
| ||
Does this not work still? |
| ||
A simple front end for windres... [EDIT] ...Can be found by clicking the link below... [/EDIT] |
| ||
Yan, the link is broke :( Russell |
| ||
Oops... :o/ Fixed now. |
| ||
tonyg - I followed the tutorial precisely, and my executable *does* contain an icon. However, it is only displayed in the windows explorer interface, not in the application's upper left corner when running. I compiled a *.ico file using snidesoft's tool, containing a 32x32 bitmap and a 16x16 bitmap, and correctly compiled it using a *.rc file using windres.exe. I'm stumped. |
| ||
I'm stumped. ...And blind, it seems. ;op |
| ||
Tony's link points to an old-style method of setting the icon which isn't perfect (well actually let me be more precise, Jim Brown's method works to get the icon in some places but not the title bar, the old-style SetClassLong method to set the title bar icon doesn't work in XP with the standard theme but does work with Windows Classic theme - figure that one out!) After lots of painful research I added the following code to my BlitzMax Game Framework which always works. You still need to have an exe icon like you are already doing with Jim Brown's tutorial: ' ----------------------------------------------------------------------------- ' ccSetIcon ' ----------------------------------------------------------------------------- Function ccSetIcon(iconname$, TheWindow%) ?Win32 Local icon=ExtractIconA(TheWindow,iconname,0) Local WM_SETICON = $80 Local ICON_SMALL = 0 Local ICON_BIG = 1 ' sendmessage(TheWindow, WM_SETICON, ICON_SMALL, icon) 'don't need this sendmessage(TheWindow, WM_SETICON, ICON_BIG, icon) ' SetClassLongA(TheWindow,-14,icon)'obsolete as it doesn't work with Windows XP Theme! ? End Function 'call it like this ccSetIcon(AppFile, GetActiveWindow()) and the externs: ?win32 Extern "win32" Function ExtractIconA%(hWnd%,File$z,Index%) Function GetActiveWindow%() Function SendMessage:Int(hWnd:Int,MSG:Int,wParam:Int,lParam:Int) = "SendMessageA@16" End Extern ? |
| ||
Tony's link points to an old-style method and also contains a link to your Code Archive entry which seems to have been missed or not read. |
| ||
yeah there is a link in there to a post of mine, but it's an old-style method too. here is the latest code archive entry (the update from Yan probably doesn't work on BMax 1.24 due to the call to PrimaryDevice): http://www.blitzbasic.com/codearcs/codearcs.php?code=1841 |
| ||
Course it does! ;o) As does the version included in the MakeObject.zip linked above (probably should have mentioned that in the original post). :o) |
| ||
... and all would have led to an icon in the top-left. . Yan's MakeObject works nicely and unless I am missing something (or it's been edited) there isn't a reference to primarydevice in that code archive. Never mind I am sure Tylerbot now has an icon in the top left. |
| ||
Yan's ;-) says it all. EDITOR! ;-) |
| ||
I'll probably be flamed hardcore for saying this, but - shouldn't the ability to assign an icon to an executable be part of the compilation process (as with dev-cpp)? |
| ||
Oh and btw Yan - thanks for the MakeObject code, it works fine. I didn't notice you had fixed the link. |
| ||
shouldn't the ability to assign an icon to an executable be part of the compilation process Many would agree. |
| ||
yup in agreement here. |