yes its compatible with windowsXP
i copy windres.exe from minGW to a folder somewhere (i keep it by all my projects) along with my Icon, and my resfile.rc
now you should have 3 files in this "IconMaker" folder:
1: icon.ico ;your icon (32x32 .ico)
2: resfile.rc ;with the lines:
101 ICON icon.ico
3: windres.exe ; from your MinGW/bin
Now, open notepad and add the following line:
windres -i resfile.rc -o icon_import.o
save this as build.bat in the same "IconMaker" folder
now open a DOS window (command prompt) and drag and drop that build.bat file into the command prompt window. now press enter. and you'll have a new file in the "IconMaker" folder icon_import.o
now import this into your bmax programs and that will give you your main icon.
this was hard to set up, but now making a new icon res file is as easy as dropping a new icon into that folder and deleting the other one then calling it on command prompt.
Now to get it on the window call the following function right after Graphics.
' -----------------------------------------------------------------------------
' ccSetIcon
' -----------------------------------------------------------------------------
Function SetIcon(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_BIG, icon)
?
End Function
'call it like this
SetIcon(AppFile, GetActiveWindow())
you'll also need the following win32 externs:
'Needed 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
?
Credits to grey alien for that function, this will extract the icon out of your exe file and display it on the window.
now the result is a completely independant compiled exe that needs no external files to display its icon.
heres an example:
Import "icon_import.o"
'Needed 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
?
Graphics 800,600
SetIcon(AppFile,GetActiveWindow())
While Not AppTerminate() = True
Cls
Flip
Wend
End
Function SetIcon(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_BIG, icon)
?
End Function