Here is a skeleton of the code I'm writing...
Code: Select all
MyWindow.l = OpenWindow(#PB_Any,0,0,200,100,"Test",#PB_Window_ScreenCentered)
AddKeyboardShortcut(MyWindow.l, #PB_Shortcut_Escape, 100) ; ESC hot key for exit
StickyWindow(MyWindow.l,1)
While 1
HideWindow(MyWindow,1) ; Hide the window
Delay(2000) ; Wait (Usually about 30 minutes)
Beep_(1000,10) ; Attract user's attention
HideWindow(MyWindow,0) ; Un-hide the window
DisableWindow(MyWindow.l,#True)
; Skeleton of my code that handles user input, timing and comms.
WaitTime = ElapsedMilliseconds() + 2000 ; Wait duration for user input (Usually 1 minute)
While WaitTime > ElapsedMilliseconds()
Delay(1)
Select WindowEvent()
Case #PB_Event_Menu
Select EventMenu()
Case 100 : Break 2
EndSelect
EndSelect
; Async Comms here
Wend
Wend
How to see my problem...
Open another application that accepts keyboard input (eg: MS Word)
Run my code
Click in the Test window when visible (Test's title bar becomes active)
Wait for Test window to hide
Click on MS Word
Note how Word title bar toggles on/off and keys become inactive when Test window is visible
Wait for Test window to appear and immediately click on desktop.
Test window now toggles on / off but does not have focus.
MS Word title no longer toggles.
How can I ensure that the Test window does NOT have the focus?