how to detect when is made logoff and perform an action?

Hi,

how to detect when is made logoff and perform an action?
or its not possible ?

thanks in advance.
davizinxAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TheRealLokiConnect With a Mentor Senior DeveloperCommented:
don't you just capture the wm_QueryEndSession message?
e.g.

private
  procedure WMQueryEndSession(var Msg : TWMQueryEndSession) ; message WM_QueryEndSession;


...
procedure TForm1.WMQueryEndSession(var Msg : TWMQueryEndSession) ;
begin
// If you want to stop the log off/ shut down do the next line
//   Msg.Result := 0
// otherwise, except that we are logging off/ shutting down
  // do any clean up you want here then do the folllowing
   Msg.Result := 1 ;
end;
0
 
SteveBayCommented:
It look like logoff activity is pretty well explain here:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20525770
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
davizinxAuthor Commented:
SteveBay:
when i try go to your link:
show this message:
Zone Not Found
0
 
davizinxAuthor Commented:
god, forget what I said above.
0
 
ChristianWimmerConnect With a Mentor Commented:
Some problems here:
1. Winlogon Notification Packages are not supported in Windows Vista.
2. WTSRegisterSessionNotification cannot be used in a service since it uses Window messages which are blocked over session barriers.
3. RegisterServiceCtrlHandlerEx/HandlerEx could be used if TService implementation would allow it. However if you write your own service implementation this can be an option. (Some problems exists in Windows 2000)

However SENS COM API can be a good option. (https://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/jwapi/branches/2.2a/Examples/SENS/WinLogonLogo/)
0
 
davizinxAuthor Commented:
ChristianWimmer:
Your example is missing several files .dcu
-
SteveBay:
It seems to be what I want, but because I understand little English could not do what he wanted and fully understand.
 could make a ready example of what I want?
Thanks in advance.
0
 
ChristianWimmerCommented:
The example is using the JEDI API Windows Headers that are also available here: blog.delphi-jedi.net
I just pointed to the subversion repository. If you download the sources you'll also get the examples.
0
 
davizinxAuthor Commented:
good
0
All Courses

From novice to tech pro — start learning today.