minimizing widow to tray: api_ShowWindow() bug?

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

Andres(Posted 2007) [#1]
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)