process still running after quitting the app
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Back home - so giving this a go..
I got the "Already Running!" box after re-running it. As I type this I see it is still in the Task Manager quite a while later (about a minute later ). I guess I've got some fundamental system problem here.. I'll investigate some more. Thanks netmaestro alot for your kind help.netmaestro wrote:OK, one more test. Run this code, close the window and then immediately try to run it again.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
You people don't have humour.netmaestro wrote:Hi PB - I'm pretty sure it was a joke.
No, you didn't.(feeble? did I say that?)
Test this:
Code: Select all
Procedure Init()
InitSprite()
OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
EndProcedure
Procedure MainLoop()
quit.l = 0
Repeat
eventID = WaitWindowEvent()
Until quit = 1 Or eventID = #PB_Event_CloseWindow
CloseScreen()
CloseWindow(0)
MessageRequester("End", "Before end")
End
MessageRequester("End", "After end")
EndProcedure
Init()
MainLoop()
Well this is very interesting.. I don't have the process problem with Trond's code.. While watching the task manager, immediately after clearing the "before end" dialog, I see the task disappear along with the window. The dialog "after end" is not seen (as could be expected). Thanks very much Trond for this - now just have to figure out why it's ok.. obviously there's no keyboard stuff in this one. I'll tinker with this to see what I can find.
After an initial investigation, I think the issue is due to ExamineKeyboard(). The following code causes the problem, but if I comment out ExamineKeyboard() I don't have the problem.
Code: Select all
Procedure Init()
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
EndProcedure
Procedure MainLoop()
quit.l = 0
ExamineKeyboard()
Repeat
eventID = WaitWindowEvent()
Until quit = 1 Or eventID = #PB_Event_CloseWindow
CloseScreen()
CloseWindow(0)
End
EndProcedure
Init()
MainLoop()
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Thanks but I'm still getting the issue
I thought maybe changing to
might be worth it, but it not reliable either. I say reliable because after running so many test cases, there are rare times that it does work with WaitWindowEvent(1) but usually it locks up the process.
Code: Select all
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
ExamineKeyboard()
Repeat
Delay(1)
eventID = WindowEvent()
Until eventID = #PB_Event_CloseWindow
CloseScreen()
CloseWindow(0)
End
Code: Select all
eventID = WaitWindowEvent(1)
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I was so sure that would fix it.
But it's beginning to look as if ExamineKeyboard() isn't working correctly on your machine. What are your specs on the machine with the problem?
As a temporary fix until you get it sorted out you could switch to GetAsyncKeyState_() instead of ExamineKeyboard. That should definitely fix it.

As a temporary fix until you get it sorted out you could switch to GetAsyncKeyState_() instead of ExamineKeyboard. That should definitely fix it.
BERESHEIT
Thanks for that - well using the following gives no problem..
So you were right. Why would GetAsyncKeyState work and not ExamineKeyboard. What is also scary is why others don't see this problem.
My machine spec is a Toshiba Satellite P20 laptop running XP Pro SP2.
[edit: fortunately the keyboard is just a way to bail out - I get users to press an on-screen button, but this behaviour has got me wondering..]
Code: Select all
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
;ExamineKeyboard()
GetAsyncKeyState_(#PB_Key_Escape)
Repeat
eventID = WaitWindowEvent()
Until eventID = #PB_Event_CloseWindow
CloseScreen()
CloseWindow(0)
End
My machine spec is a Toshiba Satellite P20 laptop running XP Pro SP2.
[edit: fortunately the keyboard is just a way to bail out - I get users to press an on-screen button, but this behaviour has got me wondering..]
Another thing to try on yours ... put ExamineKeyboard() before OpenWindowedScreen() and try it. Although I should probably read the history of this conversation before mentioning this...
..: Edit :.. And does this still stay in memory?
..: Edit 2 :.. And what happens if you add ...
... that line somewhere in your loop? Just curious to see what happens, Mr. Guinea Pig
Although, I suppose you'll need to put the ExamineKeyboard() call in your loop too.
..: Edit 3 :.. Did you check your directx drivers on that machine? What was that program called? dxdialog? Something like that?
..: Edit :.. And does this still stay in memory?
Code: Select all
InitSprite()
InitKeyboard()
;
If OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
;
If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
;
ExamineKeyboard()
;
quit.l = 0
;
Repeat
EventID = WaitWindowEvent()
Until quit = 1 Or EventID = #PB_Event_CloseWindow
;
CloseScreen()
;
EndIf
;
CloseWindow(0)
;
EndIf
;
End
Code: Select all
If KeyboardPushed(#PB_Key_Escape) : quit = 1 : EndIf

..: Edit 3 :.. Did you check your directx drivers on that machine? What was that program called? dxdialog? Something like that?
Last edited by Xombie on Fri Aug 25, 2006 10:54 pm, edited 3 times in total.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Thanks Xombie.
I'm using DX 9.0c.
I think it's not possible to do it (gets an error)Xombie wrote:Another thing to try on yours ... put ExamineKeyboard() before OpenWindowedScreen() and try it.
Yes..: Edit :.. And does this still stay in memory?
Still stays in memory...: Edit 2 :.. And what happens if you add ...... that line somewhere in your loop? Just curious to see what happensCode: Select all
If KeyboardPushed(#PB_Key_Escape) : quit = 1 : EndIf
I'm using DX 9.0c.