Solved

Hooking windows Service

Posted on 2000-03-08
5
270 Views
Last Modified: 2013-12-03
I want to run some procedure (say print my name in a message Box) whenever I logout or shutdown my computer.(ie . I want to hook the windows service and run my routine and then run the windows service).

I dont know if I use proper term (Hooking).But I think U understand my question.
Please answer to my question.
0
Comment
Question by:pamboo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Accepted Solution

by:
sinclairj earned 200 total points
ID: 2595366
The InitiateSystemShutdown function initiates a shutdown and optional restart of the specified computer.

To record a reason for the shutdown in the event log, call the InitiateSystemShutdownEx function.


This is straight from MSDN January 2000 edition.
0
 
LVL 2

Expert Comment

by:DarrinE
ID: 2595558
Infact what you should be looking at is the WM_QUERYENDSESSION and WM_ENDSESSION messages




case WM_QUERYENDSESSION :
 {
  ReportingMeasure("WM_QUERYENDSESSION");      
  return FALSE;
 }
case WM_ENDSESSION :
 {
  BOOL fEndSession = (BOOL) wParam;     // end-session flag
  BOOL fLogOff =  lParam;               // logoff flag

 if(lParam & ENDSESSION_LOGOFF) // really logging off else we're shutting down
ReportingMeasure("WM_ENDSESSION");
 return FALSE ;
 }
 
Where reportingMeasure appears - do what you have to do when shuttingdown

If you need more ask

Darrin
0
 
LVL 3

Author Comment

by:pamboo
ID: 2602974
Darin i nedd more from U.
0
 
LVL 3

Author Comment

by:pamboo
ID: 2602984


I want more answer from darrin
0
 
LVL 2

Expert Comment

by:DarrinE
ID: 2603767
Your question has already been answered and accepted - what do you need to know ?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question