Recognize Windows Shutdown  
Author Message
N. Hamacher





PostPosted: 2004-6-18 21:57:00 Top

java-programmer, Recognize Windows Shutdown Hi,

how can i recognize that Windows is shutting down (when i'm logged off)?

Sorry for stupid questions, but i didn't found the right solution!

Greets,

Nico

-> remove the underscores in the email <-

 
N. Hamacher





PostPosted: 2004-6-18 21:58:00 Top

java-programmer >> Recognize Windows Shutdown Hi,

how can i recognize that Windows is shutting down (when i'm logged off)?

Sorry for stupid questions, but i didn't found the right solution!

Greets,

Nico

-> remove the underscores in the email <-


 
Andrew Thompson





PostPosted: 2004-6-18 23:09:00 Top

java-programmer >> Recognize Windows Shutdown On Fri, 18 Jun 2004 15:58:20 +0200, N. Hamacher wrote:

> how can i recognize that Windows is shutting down

<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)>

(that URL will break..)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Andrew Thompson





PostPosted: 2004-6-18 23:11:00 Top

java-programmer >> Recognize Windows Shutdown On Fri, 18 Jun 2004 15:56:41 +0200, N. Hamacher wrote:

> Sorry for stupid questions, but i didn't found the right solution!

You probably will be less likely to find
it if you multi-post (ironically)
<http://www.physci.org/codes/javafaq.jsp#xpost>

See my answer on..
<http://www.physci.org/codes/javafaq.jsp#cljh>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
N. Hamacher





PostPosted: 2004-6-21 15:56:00 Top

java-programmer >> Recognize Windows Shutdown Hi,

how can i catch / recognize a Windows shutdown - means: a shutdown
signal given by the OS (not by the user)?
I have to save some data before closing the program.
Mybe someone could give me a hint?

greets,

Nico


(delete the underscores in the email-address)

 
 
N. Hamacher





PostPosted: 2004-6-21 15:56:00 Top

java-programmer >> Recognize Windows Shutdown Hi,

how can i catch / recognize a Windows shutdown - means: a shutdown
signal given by the OS (not by the user)?
I have to save some data before closing the program.
Mybe someone could give me a hint?

greets,

Nico


(delete the underscores in the email-address)

 
 
N. Hamacher





PostPosted: 2004-6-21 15:56:00 Top

java-programmer >> Recognize Windows Shutdown Hi,

how can i catch / recognize a Windows shutdown - means: a shutdown
signal given by the OS (not by the user)?
I have to save some data before closing the program.
Mybe someone could give me a hint?

greets,

Nico


(delete the underscores in the email-address)

 
 
Christophe Vanfleteren





PostPosted: 2004-6-21 15:58:00 Top

java-programmer >> Recognize Windows Shutdown N. Hamacher wrote:

> Hi,
>
> how can i catch / recognize a Windows shutdown - means: a shutdown
> signal given by the OS (not by the user)?
> I have to save some data before closing the program.
> Mybe someone could give me a hint?
>

Use a shutdownhook:

<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)>

--
Kind regards,
Christophe Vanfleteren
 
 
Christophe Vanfleteren





PostPosted: 2004-6-21 16:03:00 Top

java-programmer >> Recognize Windows Shutdown N. Hamacher wrote:

> Hi,
>
> how can i catch / recognize a Windows shutdown - means: a shutdown
> signal given by the OS (not by the user)?
> I have to save some data before closing the program.
> Mybe someone could give me a hint?


Please don't multi-post. I gave you an answer in c.l.j.programmer.

--
Kind regards,
Christophe Vanfleteren
 
 
Christophe Vanfleteren





PostPosted: 2004-6-21 16:03:00 Top

java-programmer >> Recognize Windows Shutdown N. Hamacher wrote:

> Hi,
>
> how can i catch / recognize a Windows shutdown - means: a shutdown
> signal given by the OS (not by the user)?
> I have to save some data before closing the program.
> Mybe someone could give me a hint?
>

Please don't multi-post. I gave you an answer in c.l.j.programmer.

--
Kind regards,
Christophe Vanfleteren
 
 
Mark Thornton





PostPosted: 2004-6-22 2:14:00 Top

java-programmer >> Recognize Windows Shutdown Christophe Vanfleteren wrote:
> N. Hamacher wrote:
>
>
>>Hi,
>>
>>how can i catch / recognize a Windows shutdown - means: a shutdown
>>signal given by the OS (not by the user)?
>>I have to save some data before closing the program.
>>Mybe someone could give me a hint?
>>
>
>
> Use a shutdownhook:
>
> <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)>
>

While that works for command line type applications or demons, it
usually fails for anything with a gui. (The problem is specific to
Windows.) I have an application with a shutdown hook installed, however
if the user logs out the application is terminated before the hook gets
a chance to run.

Mark Thornton