Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hooking windows Service

Posted on 2000-03-08
5
Medium Priority
?
277 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
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

782 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