Message-only windows
Posted: Mon Dec 28, 2009 3:15 pm
On Windows, you can convert any window to an invisible message-only window using SetParent_() after the window is created, but currently v4.40 is giving an error message "Invalid parent handle" if you try to put it in the OpenWindow() command.
Such a window is desirable for applications whose primary communication with the user is a systray icon.
Code snippet shows a window being converted to message-only after 2 seconds using SetParent. It becomes invisible, loses the taskbar icon, and becomes a message pump only:
Such a window is desirable for applications whose primary communication with the user is a systray icon.
Code snippet shows a window being converted to message-only after 2 seconds using SetParent. It becomes invisible, loses the taskbar icon, and becomes a message pump only:
Code: Select all
#HWND_MESSAGE = -3
OpenWindow(0,0,0,512,512,"Message Window Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) ; try to put it here :(
; wait 2 seconds
start = ElapsedMilliseconds()
While ElapsedMilliseconds()-start < 2000
WaitWindowEvent(1)
Wend
SetParent_(WindowID(0), #HWND_MESSAGE)
; wait 2 seconds
start = ElapsedMilliseconds()
While ElapsedMilliseconds()-start < 2000
WaitWindowEvent(1)
Wend
Debug "Test finished"