views:

145

answers:

3

Greetings all,

I'm working on a Windows program whose installation necessitates restarting explorer.exe. I know "Reboot your computer to complete the installation" is the standard method here, but I'd like my installer to give users the option of just restarting Explorer so they can start using my program immediately. What's the best way to do that? Of course I could just find and kill the process, but that seems rather icky. Is there some trick to, say, make Explorer think the user is logging off and close cleanly?

Thanks!

+1  A: 

I could try to call ExitProcess or TerminateProcess to stop explorer.exe.

compie
A: 

You could send it the WM_ENDSESSION message.

That might trick it into thinking the computer is shutting down. Then it will hopefully free all resources, close all open explorer windows, etc.

Then when it is closed, you can restart the process.

George Edison
A: 

Is this an MSI install?

Have you considered using the Restart Manager?

Restart Manager will detect which processes are holding files/handles open and need to be restarted, and allow you to automatically stop/start those processes without a restart.

William Leara