Is this an intermittent bug or am I just not understanding PureBasic right. Should I be using GetActiveWindow() differently?
Code: Select all
For c = 1 To 1000
ShowDebugOutput()
Debug "Count: " + c
OpenWindow(0,100, 100, 640, 480, "Test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
Repeat
Event = WaitWindowEvent(10)
Select Event
Case #PB_Event_MoveWindow
Debug "Window moved"
Case #PB_Event_DeactivateWindow
Debug "Window deactivated"
Case #PB_Event_ActivateWindow
Debug "A window has been activated"
w = GetActiveWindow()
If w = -1
Debug "Yet there are no active windows"
End
Else
Debug "Active window: " + w
EndIf
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Event = 0
CloseWindow(0)
CloseDebugOutput()
Next