By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

Way is my program still running after i have pressed the X on the form?

P: n/a
I am using Win XP and when I exit my program by clicking the X it locks like
it is closed but if I check the Activity Handler( I don't know the right
English word for it) it is still there under program...

Do I need to do anything in the code handle the shut down?

Yours, Jonas
Jul 17 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
> I am using Win XP and when I exit my program by clicking the X it locks like
it is closed but if I check the Activity Handler( I don't know the right
English word for it) it is still there under program... The name of it Task Manager, but you're so close!
Do I need to do anything in the code handle the shut down?

Not unless you have things still running in your program. The program does not
close if it has code still executing, such as an open form, API commands which
are still processing (or haven't been 'closed'), Timer controls still running,
etc.
If you do have such bits running, use the Query_Unload event to somehow stop
them by some form of global variable (Such as haltEverything = True) which is
checked in these other subroutines (If haltEverything = True Then Exit Sub or
whatever) which causes a mass close down of the program, then clear if need be
(delete temporary files, set variables to Empty, etc).
When the program then issues it's final command, hopefully the program will end.
However, after a clear up, I still use the End command to ensure everything else
ends (Some people would disagree).

Hope this helps, and hope it makes sense.

--
QuickHare
(QuickHare "at" Hotmail "dot" com)
Jul 17 '05 #2

P: n/a
You still have a reference in use. Post the precise code you use to show
the form, the code you use to close it, as well as any code in the
queryunload, unload and terminate events.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"BadOmen" <ba*******@hotmail.com> wrote in message
news:n7********************@newsb.telia.net...
: I am using Win XP and when I exit my program by clicking the X it locks
like
: it is closed but if I check the Activity Handler( I don't know the right
: English word for it) it is still there under program...
:
: Do I need to do anything in the code handle the shut down?
:
: Yours, Jonas
:
:
Jul 17 '05 #3

P: n/a
thanx
I had to unload a form that I use to display what button is pressed on a
remote control, I am just making it visible true or false to show the button
pressed.
Now it works as it should. :-)

Just out of curiosity:

I am using some API's and a Timer.

My API's are mostly about getting foreground window and SendInput and
setting some window positions.
Can you give me some examples when I have to close an API?
And how to close??

The timer makes the form that displays the button pressed to show just 3 sec
and then go invisible.
When do I need to disable a time control?

I am just about to learn VB :)


"QuickHare" <Qu*******@Hotmail.c> skrev i meddelandet
news:c1*************@athena.ex.ac.uk...
I am using Win XP and when I exit my program by clicking the X it locks like it is closed but if I check the Activity Handler( I don't know the right
English word for it) it is still there under program... The name of it Task Manager, but you're so close!


I will try to remember that :)
Do I need to do anything in the code handle the shut down? Not unless you have things still running in your program. The program does

not close if it has code still executing, such as an open form, API commands which are still processing (or haven't been 'closed'), Timer controls still running, etc.
If you do have such bits running, use the Query_Unload event to somehow stop them by some form of global variable (Such as haltEverything = True) which is checked in these other subroutines (If haltEverything = True Then Exit Sub or whatever) which causes a mass close down of the program, then clear if need be (delete temporary files, set variables to Empty, etc).
When the program then issues it's final command, hopefully the program will end. However, after a clear up, I still use the End command to ensure everything else ends (Some people would disagree).

Hope this helps, and hope it makes sense.

--
QuickHare
(QuickHare "at" Hotmail "dot" com)

Jul 17 '05 #4

P: n/a
On Thu, 26 Feb 2004 23:51:27 GMT, "BadOmen" <ba*******@hotmail.com>
wrote:
thanx
I had to unload a form that I use to display what button is pressed on a
remote control, I am just making it visible true or false to show the button
pressed.
Now it works as it should. :-)

Just out of curiosity:

I am using some API's and a Timer.

My API's are mostly about getting foreground window and SendInput and
setting some window positions.
Can you give me some examples when I have to close an API?
And how to close??

The timer makes the form that displays the button pressed to show just 3 sec
and then go invisible.
When do I need to disable a time control?

I am just about to learn VB :)


In the Query_Unload event
put Timer1.Enabled = False

I am not sure what you mean by 'closing an API'
Jul 17 '05 #5

P: n/a
> >My API's are mostly about getting foreground window and SendInput and
setting some window positions.
Can you give me some examples when I have to close an API?
And how to close??


I am not sure what you mean by 'closing an API'


I'm sorry. I coined the phrase. What I meant was that some APIs prefer to be
'closed', eg. Registry commands or video streaming APIs. These require to close
the Registry, video stream, file, etc so that Windows can release the memory or
unlock files, etc.
You can spot these APIs by the fact you must use one to open something, another
to use the feature, then use a final API to close and finish with the feature.

Put simply, if you don't use something which states you must close it after use,
then no need to worry.
Sorry if my meaning was unclear. I was a tiring night...

--
QuickHare
(QuickHare "at" Hotmail "dot" com)
Jul 17 '05 #6

P: n/a
On Fri, 27 Feb 2004 22:20:40 -0000, "QuickHare" <Qu*******@Hotmail.c>
wrote:
>My API's are mostly about getting foreground window and SendInput and
>setting some window positions.
>Can you give me some examples when I have to close an API?
>And how to close??


I am not sure what you mean by 'closing an API'


I'm sorry. I coined the phrase. What I meant was that some APIs prefer to be
'closed', eg. Registry commands or video streaming APIs. These require to close
the Registry, video stream, file, etc so that Windows can release the memory or
unlock files, etc.
You can spot these APIs by the fact you must use one to open something, another
to use the feature, then use a final API to close and finish with the feature.

Put simply, if you don't use something which states you must close it after use,
then no need to worry.


Ah, I see what you mean
- files are no problem
- not sure about the rest ... interesting ...
Jul 17 '05 #7

P: n/a
Thanx guys!

Now you have cleared up some things for me :)

Yours, Jonas

"J French" <er*****@nowhere.com> skrev i meddelandet
news:40****************@news.btclick.com...
On Fri, 27 Feb 2004 22:20:40 -0000, "QuickHare" <Qu*******@Hotmail.c>
wrote:
>My API's are mostly about getting foreground window and SendInput and
>setting some window positions.
>Can you give me some examples when I have to close an API?
>And how to close??

I am not sure what you mean by 'closing an API'


I'm sorry. I coined the phrase. What I meant was that some APIs prefer to be'closed', eg. Registry commands or video streaming APIs. These require to closethe Registry, video stream, file, etc so that Windows can release the memory orunlock files, etc.
You can spot these APIs by the fact you must use one to open something, anotherto use the feature, then use a final API to close and finish with the feature.
Put simply, if you don't use something which states you must close it after use,then no need to worry.


Ah, I see what you mean
- files are no problem
- not sure about the rest ... interesting ...

Jul 17 '05 #8

P: n/a
Thanx but I have got the answers I need already :)

"Randy Birch" <rg************@mvps.org> skrev i meddelandet
news:Vj*******************@news04.bloor.is.net.cab le.rogers.com...
You still have a reference in use. Post the precise code you use to show
the form, the code you use to close it, as well as any code in the
queryunload, unload and terminate events.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"BadOmen" <ba*******@hotmail.com> wrote in message
news:n7********************@newsb.telia.net...
: I am using Win XP and when I exit my program by clicking the X it locks
like
: it is closed but if I check the Activity Handler( I don't know the right
: English word for it) it is still there under program...
:
: Do I need to do anything in the code handle the shut down?
:
: Yours, Jonas
:
:

Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.