Solved

Hooking windows Service

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now