|
From: ender w. <end...@ya...> - 2003-09-24 13:44:23
|
Hello.
First some details:
I am working on a project involving an instant one way
messaging on windows. Basically I am writing a
service(SocketService) that connects with a server
through a socket and writes to file/(some repository)
the messages it receives. Another service(
DesktopMessageService) reads from the files the
messages and if it finds a new message for the CURRENT
user it will open a frame and show it on the screen.
The reason I use two services instead of one is
because I read that a service either does neworking or
it accesses the desktop or console.
The SocketService performs well, it does indeed read
from a socket(ServerSocket) and when contacted there
are messages it does store them on file.
The problems arise with the DesktopMessageService.I
have yet to find a way to detect the current
user.Basically when the pc is booted the
DesktopMesssage starts ,tries to detect the current
user and print to screen a message.The problem is that
I cannot decect when a user loggs on to the machine.
The current user for the DesktopService is still
System.So if I want to print a message Hi +
System.getProperty("user.name") , even if there is a
user logged on it still prints Hi System , not Hi
"Current User Name".Im also tried to restart the JVm
periodically but the curent user is still System.
By the way the service works fine when tested in a
console .
So my questions are, Is there a way to detect when a
user loggs on and get his name?
Also, is there a way to detect when a users logs off?
Thanks, Alex
=====
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
|