Solved

Hooking windows Service

Posted on 2000-03-08
5
260 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

823 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