From: Dee Earley on
On 11/03/2010 11:37, Vilius Mockunas wrote:
> Hello,
>
> I want to shutdown explorer.exe by imitating Ctrl+Alt+Shift+"Cancel button
> push by mouse"
> Of course I can write my own code, but I consider this method more reliable.

What exactly are you trying to do?
You have a bad idea in your head that this is the correct solution to
something and it is not.

If you try telling us exactly what you are trying to accomplish (Just
shutting down explorer is not a good thing) we can tell you the correct
and documented way of doing it.

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems
From: Ivo Beltchev on
You can try to locate the top-level window with class "Progman" and post
WM_QUIT to it. Keep in mind that sometimes there are 2 explorer
processes that are running - one for the Desktop/taskbar and one for the
Explorer windows. Also on 64-bit Vista there may be a 32-bit Explorer
also running (if a 32-bit process has launched "explorer.exe").

Vilius Mockunas wrote:
> Hello,
>
> I want to shutdown explorer.exe by imitating Ctrl+Alt+Shift+"Cancel button
> push by mouse"
> Of course I can write my own code, but I consider this method more reliable.
>
> V
>
>
> "Kerem G�mr�kc�" <kareem114(a)hotmail.com> wrote in message
> news:%23etZ%23FKwKHA.1796(a)TK2MSFTNGP02.phx.gbl...
>> What exactly do you want to do?
>> Why do you want to hook that dialog and
>> why do you want to intercept this dialog?
>>
>> regards
>>
>> Kerem
>>
>> --
>> -----------------------
>> Beste Gr�sse / Best regards / Votre bien devoue
>> Kerem G�mr�kc�
>> Latest Project: http://www.pro-it-education.de/software/deviceremover
>> Latest Open-Source Projects: http://entwicklung.junetz.de
>> -----------------------
>>
>> "Vilius Mockunas" <v_mockunas(a)yahoo.com> schrieb im Newsbeitrag
>> news:Od2Cc5GwKHA.812(a)TK2MSFTNGP06.phx.gbl...
>>> But if I want to install hook I need thread id - how do I get it in this
>>> case ?
>>>
>>> V
>>>
>>> "Dee Earley" <dee.earley(a)icode.co.uk> wrote in message
>>> news:OwXXnODwKHA.1692(a)TK2MSFTNGP04.phx.gbl...
>>>> On 09/03/2010 08:07, Vilius Mock�nas wrote:
>>>>> Hello,
>>>>>
>>>>> How do I get shutdown dialog window handle (which shows after Alt+F4) ?
>>>>> After displaying the dialog user input is almost disabled so it's hard
>>>>> to
>>>>> identify process which created the dialog, but I suspect explorer.exe.
>>>> CBT hooks.
>>>>
>>>> Can I ask why you want to do this?
>>>> You r app should not be doing anything with this dialog as it is for the
>>>> USER to choose.
>>>>
>>>> If you want to shut down windows, there are fully documented APIs to do
>>>> it.
>>>>
>>>> --
>>>> Dee Earley (dee.earley(a)icode.co.uk)
>>>> i-Catcher Development Team
>>>>
>>>> iCode Systems
>>>
>
>
From: Ivo Beltchev on
I had a similar problem but decided not to solve it. I have a shell
extension (http://classicshell.sourceforge.net/) that is installed by an
MSI file (created by a Visual Studio Setup project). During uninstall
the shell extension is in use by Explorer. It will be nice if the
uninstaller (or the installer during upgrade to a new version) can close
all Explorer processes, and relaunch Explorer when the setup is done.

I decided to give up on this because I could not find a good way to
relaunch Explorer from the installer. The installer runs as the SYSTEM
user and can't launch explorer.exe on behalf of the current user.

If somebody has figured out how to do this, I'll be very grateful if you
share :)

Dee Earley wrote:
> On 11/03/2010 11:37, Vilius Mockunas wrote:
>> Hello,
>>
>> I want to shutdown explorer.exe by imitating Ctrl+Alt+Shift+"Cancel
>> button
>> push by mouse"
>> Of course I can write my own code, but I consider this method more
>> reliable.
>
> What exactly are you trying to do?
> You have a bad idea in your head that this is the correct solution to
> something and it is not.
>
> If you try telling us exactly what you are trying to accomplish (Just
> shutting down explorer is not a good thing) we can tell you the correct
> and documented way of doing it.
>
From: Nobody on
"Ivo Beltchev" <ivo(a)ivo.com> wrote in message
news:Oq3UdkTwKHA.4492(a)TK2MSFTNGP05.phx.gbl...
>I had a similar problem but decided not to solve it. I have a shell
>extension (http://classicshell.sourceforge.net/) that is installed by an
>MSI file (created by a Visual Studio Setup project). During uninstall the
>shell extension is in use by Explorer. It will be nice if the uninstaller
>(or the installer during upgrade to a new version) can close all Explorer
>processes, and relaunch Explorer when the setup is done.
>
> I decided to give up on this because I could not find a good way to
> relaunch Explorer from the installer. The installer runs as the SYSTEM
> user and can't launch explorer.exe on behalf of the current user.
>
> If somebody has figured out how to do this, I'll be very grateful if you
> share :)

It's a bad idea to close Explorer. TaskBar button are out of order, and tray
icons or missing. It's possible to run a program as the logged on user when
running as system(See CreateProcessAsUser), but it still not a good idea to
close Explorer.

Another option is to rename the inuse DLL to something temporary, then
install the replacement DLL. Renaming EXE/DLL while they are is use is
something that is supported in Windows 2000+. You can rename in use
EXE/DLL's, but you can't delete them.

In this case, you rename your DLL to something else, then install the
updated version. The new DLL will be loaded by Explorer the next time it
tries to load the DLL. I am not sure how this works with COM based DLL's
though. See this topic for details:

Dynamic-Link Library Updates
http://msdn.microsoft.com/en-us/library/ms682604(VS.85).aspx

There is also Restart Manager in Vista+:

Restart Manager:
http://msdn.microsoft.com/en-us/library/cc948910(VS.85).aspx


From: Ivo Beltchev on


Nobody wrote:
> "Ivo Beltchev" <ivo(a)ivo.com> wrote in message
> news:Oq3UdkTwKHA.4492(a)TK2MSFTNGP05.phx.gbl...
>> I had a similar problem but decided not to solve it. I have a shell
>> extension (http://classicshell.sourceforge.net/) that is installed by an
>> MSI file (created by a Visual Studio Setup project). During uninstall the
>> shell extension is in use by Explorer. It will be nice if the uninstaller
>> (or the installer during upgrade to a new version) can close all Explorer
>> processes, and relaunch Explorer when the setup is done.
>>
>> I decided to give up on this because I could not find a good way to
>> relaunch Explorer from the installer. The installer runs as the SYSTEM
>> user and can't launch explorer.exe on behalf of the current user.
>>
>> If somebody has figured out how to do this, I'll be very grateful if you
>> share :)
>
> It's a bad idea to close Explorer. TaskBar button are out of order, and tray
> icons or missing. It's possible to run a program as the logged on user when
> running as system(See CreateProcessAsUser), but it still not a good idea to
> close Explorer.
>
> Another option is to rename the inuse DLL to something temporary, then
> install the replacement DLL. Renaming EXE/DLL while they are is use is
> something that is supported in Windows 2000+. You can rename in use
> EXE/DLL's, but you can't delete them.
>
> In this case, you rename your DLL to something else, then install the
> updated version. The new DLL will be loaded by Explorer the next time it
> tries to load the DLL. I am not sure how this works with COM based DLL's
> though. See this topic for details:
>
> Dynamic-Link Library Updates
> http://msdn.microsoft.com/en-us/library/ms682604(VS.85).aspx
>
> There is also Restart Manager in Vista+:
>
> Restart Manager:
> http://msdn.microsoft.com/en-us/library/cc948910(VS.85).aspx
>

Yes, I know all that, but users still complain that they have to log
off. Also when upgrading to a new version sometimes both the new DLL and
the old DLL get loaded by Explorer - hilarity ensues. And the Restart
Manager is kind of flaky too. Sometimes it detects the dependency and
renames the files, other times it does not.

That said, my current "solution" is indeed to do nothing and rely on the
Restart Manager. But I'm not satisfied how it behaves sometimes.