Ooops
November 25, 2020, 07:47:37 AM

Author Topic: [bb] Change Window Icon by em22 [ 1+ years ago ]  (Read 683 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Change Window Icon by em22 [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
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 :
Code: BlitzBasic
  1. ; Example to change window icon in Blitz+
  2. ;
  3. ; by em22
  4. ;
  5. ; make sure you add the user decs to blitz at the end.
  6.  
  7. EditWindow=CreateWindow("Test Window",50, 50,392,186,0,1)
  8.  
  9. test=GetWinOSHandle(EditWindow)
  10. SetWindowIcon(test,"c:windowsexplorer.exe")     ; this can be an ico file or an exe with an icon resource.
  11.  
  12. Repeat  ; test loop
  13.  
  14.         id=WaitEvent()
  15.  
  16.         Select id
  17.        
  18.                 Case $803
  19.                
  20.                 End
  21.        
  22.         End Select
  23.        
  24. Forever
  25.  
  26. Function GetWinOSHandle(win)
  27.         Return(QueryObject(win,1))     
  28. End Function
  29.  
  30. Function SetWindowIcon(hWnd,ICOfile$)
  31.         icon=ExtractIconA(hWnd,ICOfile$,0)
  32.         SetClassLongA(hWnd,-14,icon)
  33. End Function
  34.  
  35. ;
  36. ; user decs - create a file called user.decls in C:Program FilesBlitzPlususerlibs, and copy the following, remove the ;
  37. ; .lib "shell32.dll"
  38. ; ShellExecuteA(hwnd%,op$,file$,params$,dir$,showcmd%)
  39. ; ExtractIconA%(hWnd%,File$,Index%):"ExtractIconA"
  40. ;
  41. ;
  42. ; .lib "user32.dll"
  43. ; SetClassLongA%(hWnd%,nIndex%,Value%):"SetClassLongA"
  44. ;
  45. ;


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[/url].


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal