SyntaxBomb - Indie Coders
Languages & Coding => Blitz Code Archives => User Libs => Topic started by: BlitzBot on June 29, 2017, 00:28:38
Title : Change Window Icon
Author : em22
Posted : 1+ years ago
Description : Here is the method for changing you Window Icon in Blitz+. There are various articles explaining the procedure but I could not get it to work until now. So, here is the procedure :)
Code :
; Example to change window icon in Blitz+
;
; by em22
;
; make sure you add the user decs to blitz at the end.
EditWindow=CreateWindow("Test Window",50, 50,392,186,0,1)
test=GetWinOSHandle(EditWindow)
SetWindowIcon(test,"c:windowsexplorer.exe") ; this can be an ico file or an exe with an icon resource.
Repeat ; test loop
id=WaitEvent()
Select id
Case $803
End
End Select
Forever
Function GetWinOSHandle(win)
Return(QueryObject(win,1))
End Function
Function SetWindowIcon(hWnd,ICOfile$)
icon=ExtractIconA(hWnd,ICOfile$,0)
SetClassLongA(hWnd,-14,icon)
End Function
;
; user decs - create a file called user.decls in C:Program FilesBlitzPlususerlibs, and copy the following, remove the ;
; .lib "shell32.dll"
; ShellExecuteA(hwnd%,op$,file$,params$,dir$,showcmd%)
; ExtractIconA%(hWnd%,File$,Index%):"ExtractIconA"
;
;
; .lib "user32.dll"
; SetClassLongA%(hWnd%,nIndex%,Value%):"SetClassLongA"
;
;
Comments :
_PJ_(Posted 1+ years ago)
Where does the QueryObject() function come from? Or is it something from Blitz+ only?
GfK(Posted 1+ years ago)
It's a native BlitzPlus function. If you're trying to set the window icon in Blitzmax then I believe there is no better way than <a href="../Community/postsfbbf.html?topic=72899" target="_blank">this</a>.