FindWindowUltimate() it's used to find the window hwnd.
So, this user32.dll function works too:
api_FindWindow("Blitz Runtime Class", "test")
Now, the problem is, given this example program, in wich way could i only keep the program icon on the system tray as minimized but running?
example progra:
; !*! this demo is for Blitz3D only. please use trayexamp.bb for BlitzPlus
; TODO: you will need to place the ggTray.dll and ggTray.decls files in a folder called userlibs under your B3D directory
; TODO: ggTray.dll will need to be in the same directory that your EXE resides in if you compile
; TODO: you need to include the FindWindowUltimate() function or something similar. it requires some entries in user32.decls and
; is located at http://www.blitzbasic.com/Community/posts.php?topic=18287
;
; TODO: either compile and run the EXE or change cAppDir$ to the hard location of the ICOs. if you choose to compile, be
; sure to put the ggTray.dll in the same directory as your EXE
;Local cAppDir$=SystemProperty("appdir")
Local cAppDir$=""
AppTitle "test"
Global cIconStop$=cAppDir$+"stop.ico"
Global cIconStart$=cAppDir$+"usergrp.ico"
; set the graphics
Graphics 400,100,16,2
If FileType(cIconStop$)<>1
Cls
Text 110,10,"you must set the icon path",True
Else
; TODO: you will need to include the FindWindowUltimate() function and its requirements
; or something similar To get the main window handle
; show the initial icon
ggTrayCreate(api_FindWindow("Blitz Runtime Class", "test"))
; set the icon
ggTraySetIconFromFile(cIconStop$)
; set the tooltip
ggTraySetToolTip("Tray Example Stopped")
; show the icon with the updated text
ggTrayShowIcon()
; main loop to handle events
Repeat
; check for a right click
If ggTrayPeekRightClick()>0
; check the tooltip to see what status we are currently at
If Instr(ggTrayGetToolTip(),"Stopped")>0
; set the icon and a new tip
ggTraySetIconFromFile(cIconStart$)
ggTraySetToolTip("Tray Example Started")
Else
; set the icon and a new tip
ggTraySetIconFromFile(cIconStop$)
ggTraySetToolTip("Tray Example Stopped")
EndIf
; TODO: show your menu here at the event mousex,mousey
Cls
Text 110,10,"click occurred at: "+ggTrayEventMouseX(ggTrayPeekRightClick())+","+ggTrayEventMouseY(ggTrayPeekRightClick()),True
; clear out the events
ggTrayClearEvents()
EndIf
; check for a left doubleclick
If ggTrayPeekLeftDblClick()>0
Exit
EndIf
Forever
; clean up the tray
ggTrayDestroy()
EndIf
So, this user32.dll function works too:
api_FindWindow("Blitz Runtime Class", "test")
Now, the problem is, given this example program, in wich way could i only keep the program icon on the system tray as minimized but running?
example progra:
; !*! this demo is for Blitz3D only. please use trayexamp.bb for BlitzPlus
; TODO: you will need to place the ggTray.dll and ggTray.decls files in a folder called userlibs under your B3D directory
; TODO: ggTray.dll will need to be in the same directory that your EXE resides in if you compile
; TODO: you need to include the FindWindowUltimate() function or something similar. it requires some entries in user32.decls and
; is located at http://www.blitzbasic.com/Community/posts.php?topic=18287
;
; TODO: either compile and run the EXE or change cAppDir$ to the hard location of the ICOs. if you choose to compile, be
; sure to put the ggTray.dll in the same directory as your EXE
;Local cAppDir$=SystemProperty("appdir")
Local cAppDir$=""
AppTitle "test"
Global cIconStop$=cAppDir$+"stop.ico"
Global cIconStart$=cAppDir$+"usergrp.ico"
; set the graphics
Graphics 400,100,16,2
If FileType(cIconStop$)<>1
Cls
Text 110,10,"you must set the icon path",True
Else
; TODO: you will need to include the FindWindowUltimate() function and its requirements
; or something similar To get the main window handle
; show the initial icon
ggTrayCreate(api_FindWindow("Blitz Runtime Class", "test"))
; set the icon
ggTraySetIconFromFile(cIconStop$)
; set the tooltip
ggTraySetToolTip("Tray Example Stopped")
; show the icon with the updated text
ggTrayShowIcon()
; main loop to handle events
Repeat
; check for a right click
If ggTrayPeekRightClick()>0
; check the tooltip to see what status we are currently at
If Instr(ggTrayGetToolTip(),"Stopped")>0
; set the icon and a new tip
ggTraySetIconFromFile(cIconStart$)
ggTraySetToolTip("Tray Example Started")
Else
; set the icon and a new tip
ggTraySetIconFromFile(cIconStop$)
ggTraySetToolTip("Tray Example Stopped")
EndIf
; TODO: show your menu here at the event mousex,mousey
Cls
Text 110,10,"click occurred at: "+ggTrayEventMouseX(ggTrayPeekRightClick())+","+ggTrayEventMouseY(ggTrayPeekRightClick()),True
; clear out the events
ggTrayClearEvents()
EndIf
; check for a left doubleclick
If ggTrayPeekLeftDblClick()>0
Exit
EndIf
Forever
; clean up the tray
ggTrayDestroy()
EndIf