🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4615

Re: Windows Shutdown Replacement

#4615
From: Tom
Date: Wed, 28 Dec 2005 19:03
62 lines
4023 bytes
First I want to thank you on your effort.

My application has three radiobuttons (Stand By, Shutdown and Restart) I 
also have a TEdit control in which user enters desired time to execute 
selected option (format is HH:MM:SS -> for example shutdown my computer 
at 19:15:00)
If I use timeout does it mean that I don't have to use TTimer control?

What I'm trying to do is not to have a shortcut on my desktop and not to 
call my application by double click on the icon on the desktop or 
anywhere else, but to call it by clicking on the Start->Turn Off Computer.

Altering the dialog seems to be the right way. I have to add TEdit 
control which will be used for entering time (if it's left empty, action 
should occur immediately and if not timer should be started). But as you 
probably guessed I don't have much experience with API functions and 
installing a hook, the only example I saw is installing a mouse hook 
(http://www.leunen.com/cbuilder/hook.html), so I'll try to find some 
tutorials and search on 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/Windowing/Hooks.asp 
, to expand my knowledge. If you have any suggestions or links to 
examples please tell me.

Thank you very much.


Remy Lebeau (TeamB) wrote:
> "Tom" <tom@net.com> wrote in message
> news:43b26430$1@newsgroups.borland.com...
> 
> 
>>Because I have the same options but I also have a TimeEdit
>>so any of this options can be executed at desired time
> 
> 
> What do you mean exactly?  Are you providing a timeout value, ie "Execute
> such-and-such option in NN seconds"?  Or are you implementing an absolute
> timer value, ie "Execute such-and-such option at NN:NN:NN AP on NN/NN/NNNN"?
> If the former, then I can understand wanting to replace/augment the dialog.
> But if the latter, then why not provide that type of configuration inside
> your own application completely separately from the OS's dialog?  Again, I
> ask, what EXACTLY are you trying to accomplish?
> 
> 
>>and that's why I wanted to replace the standard dialog with
>>my application, I thought it would be nice to call my application
>>via Start->Turn Off Computer.
> 
> 
> Rather than replace the existing dialog altogether, you can try keeping the
> existing dialog and just alter it directly as needed.  Write a DLL that
> calls the SetWindowsHookEx() function to install a WH_CBT hook into the OS.
> When the DLL receives a HCBT_ACTIVATE notification, you can check if the
> specified HWND is the dialog or not, and if so then alter it any way you
> wish, such as by adding additional controls to it.  You can also use a
> WH_CALLWNDPROC and/or WH_CALLWNDPROCRET hook to respond to messages that are
> issued for your extra controls.
> 
> 
> Gambit
> 
> 
Technical Details
Message-ID: <43b2e11a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43ad3757@newsgroups.borland.com> <43ae6026@newsgroups.borland.com> <43afd98b$1@newsgroups.borland.com> <43b25917$1@newsgroups.borland.com> <43b26430$1@newsgroups.borland.com> <43b2cfcc$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2724a76b8d806cf8
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 28 Dec 2005 20:03:40 +0100
From: Tom <tom@net.com>
Reply-To:  tom@net.com
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Windows Shutdown Replacement
References: <43ad3757@newsgroups.borland.com> <43ae6026@newsgroups.borland.com> <43afd98b$1@newsgroups.borland.com> <43b25917$1@newsgroups.borland.com> <43b26430$1@newsgroups.borland.com> <43b2cfcc$1@newsgroups.borland.com>
In-Reply-To: <43b2cfcc$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.202.87.74
Message-ID: <43b2e11a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1135796506 213.202.87.74 (28 Dec 2005 11:01:46 -0700)
Lines: 62
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail