How to receive the Shutdown signal when the user is Logout?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Miroslav_Natchev
Posted On:   Thursday, April 4, 2002 06:54 AM

How to receive the Shutdown signal when the user is Logout? Also I need to receive the signals for Focus event. For example when some application receive the focus I have to register this event. Because I am not sure that I can do this with 100% java I think that I need of some "C" code. Unfortunately I am not so good with Win API. The JRE which I use is J2SE 1.4 running on Windows 2000. I start the program using the following: In the Registry key "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun" I have the following line: "F:JavaDKJRE injavaw -server -Xrs -cp F:WorksSoftwareCosmoPhoneclasses com.cosmos.apps.phone.Cosmo   More>>

How to receive the Shutdown signal when the user is Logout?


Also I need to receive the signals for Focus event. For example when some application receive the focus I have to register this event.


Because I am not sure that I can do this with 100% java I think that I need of some "C" code. Unfortunately I am not so good with Win API.



The JRE which I use is J2SE 1.4 running on Windows 2000.


I start the program using the following:


In the Registry key "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun" I have the following line:
"F:JavaDKJRE injavaw -server -Xrs -cp F:WorksSoftwareCosmoPhoneclasses com.cosmos.apps.phone.CosmoPhone"


The main method is:
CosmoPhone cosmoPhone = new CosmoPhone();
cosmoPhone.start();


When I test the program the main method is:
CosmoPhone cosmoPhone = new CosmoPhone();
cosmoPhone.start();
try
{
Thread.sleep(5000);
}
catch(Exception ex)
{
ex.printStackTrace();
}
cosmoPhone.stop();
In this way everything is working OK.

In my constructor I do the following:
runtime.addShutdownHook(new Thread()
{
public void run()
{
try
{
setLogoutInfo();
saveLog();
CosmoPhone.this.stop();
}
catch(Throwable ex)
{
ex.printStackTrace();
}
}
});


Can you give me some suggestions?

   <<Less
About | Sitemap | Contact