minimizing widow to tray: api_ShowWindow() bug?

BlitzPlus Forums/BlitzPlus Programming/minimizing widow to tray: api_ShowWindow() bug?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I minimize the window to system tray:
If WindowMinimized(MainWindow%)
	HideGadget MainWindow%
	api_ShowWindow(win%, 0)
	ggTrayShowIcon()
Endif


but i doesn't want to bring the window back to screen:
If ggTrayPeekLeftClick()
	win% = QueryObject(MainWindow%, 1)
	ShowGadget MainWindow%
	api_ShowWindow(win%, 9)
	api_SetWindowPos(win%,-1,0,0,0,0,1 + 2 + 40)
	ggTrayHideIcon()
EndIf

instead of that it stays in the taskbar.

Is the problem with api_ShowWindow(win%, 9) ?

EDIT:
works with:
api_ShowWindow(api_GetActiveWindow(), 9)