Article View: borland.public.cppbuilder.nativeapi
Article #10350Custom Shutdown
From: Malcolm Smith
Date: Tue, 20 Apr 2004 01:08
Date: Tue, 20 Apr 2004 01:08
41 lines
2460 bytes
2460 bytes
Under XP I'm trying to use the custom features available for shutting down a system using ExitWindowsEx() but cannot get it to work. 1. On the XP machine I have enabled the event tracker and the reason dialog is shown during a normal shutdown from the START menu 2. According to MSDN (at least the way I interpret it) ExitWindowsEx has two flags. The first us an UINT that indicates the type of shutdown - this bit is fine. The Reason parameter is not explained fully for custom codes. Let's say I define a custom entry in the registry as PCS;64;0 - this means a planned shutdown, comment required, show expected shutdown dialog, major reason 64, minor reason 0. Assume also I have defined additional entries such as PCS;64;1 and PCS;64;2 From what I can follow you use the SHTDN_REASON_FLAG_USER_DEFINED flag to indicate the reason for the shutdown is user defined. So I might have something like ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_HUNG); for a normal reboot, but if I want to use the custom entry I have created in the registry I would start with something like: ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_HUNG | SHTDN_REASON_FLAG_USER_DEFINED); but how do I tell it which entry from the registry I want logged in the event viewer. I'm clearly missing something, I just cannot work out what. -- Malcolm Smith MJ Freelancing http://www.mjfreelancing.com
Technical Details
Message-ID:
<4084732e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,362cd189c238eed0,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-19 18:09:35 PST Reply-To: "Malcolm Smith" <m.smith@comvision.net.au> From: "Malcolm Smith" <m.smith@comvision.net.au> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Custom Shutdown Date: Tue, 20 Apr 2004 11:08:51 +1000 Lines: 45 Organization: Comvision Pty Ltd X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 144.137.108.190 Message-ID: <4084732e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082422062 144.137.108.190 (19 Apr 2004 17:47:42 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail