Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hooking windows Service

Posted on 2000-03-08
5
Medium Priority
?
274 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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