Click here to Skip to main content
15,886,963 members
Home / Discussions / C#
   

C#

 
GeneralRe: Shut down explorer programmatically Pin
tommazzo13-Apr-05 8:42
tommazzo13-Apr-05 8:42 
GeneralRe: Shut down explorer programmatically Pin
Ian Bowler13-Apr-05 8:48
Ian Bowler13-Apr-05 8:48 
GeneralRe: Shut down explorer programmatically Pin
Dave Kreskowiak13-Apr-05 9:08
mveDave Kreskowiak13-Apr-05 9:08 
GeneralRe: Shut down explorer programmatically Pin
Ian Bowler13-Apr-05 9:13
Ian Bowler13-Apr-05 9:13 
GeneralRe: Shut down explorer programmatically Pin
tommazzo13-Apr-05 9:38
tommazzo13-Apr-05 9:38 
GeneralRe: Shut down explorer programmatically Pin
Ian Bowler13-Apr-05 9:39
Ian Bowler13-Apr-05 9:39 
GeneralRe: Shut down explorer programmatically Pin
Dave Kreskowiak13-Apr-05 10:13
mveDave Kreskowiak13-Apr-05 10:13 
GeneralRe: Shut down explorer programmatically Pin
Ian Bowler13-Apr-05 11:18
Ian Bowler13-Apr-05 11:18 
I understand your concerns and curiosity. I'm not going to be shutting down explorer all willy-nilly. There's a good reason for it in the context of what I'm working on.

For those of you that may wonder how this all turned out, I had to import the User32.dll functions, FindWindow and PostMessage (as tommazzo suggested). The final code looks like this:


public class Win32
{
public Win32(){}

[DllImport("User32.dll")]
private static extern IntPtr FindWindow(string ClassName,
string WindowName);

[DllImport("User32.dll")]
private static extern Boolean PostMessage(IntPtr hWnd,
uint Msg,
IntPtr wParam,
IntPtr lParam);

public bool ShutdownExplorer()
{
Boolean bSuccess = false;
IntPtr Handle = new IntPtr(0);
// Get a handle to explorer.exe
Handle = FindWindow("Progman", null);
// Shutdown explorer.exe
if(Handle != IntPtr.Zero) bSuccess = PostMessage(Handle,
0x0012,
IntPtr.Zero,
Ptr.Zero);
return bSuccess;
}
}

Thanks tommazzo for the solution. Thanks Dave for your insights.

Regards,

Ian

GeneralRe: Shut down explorer programmatically Pin
Dave Kreskowiak13-Apr-05 8:49
mveDave Kreskowiak13-Apr-05 8:49 
GeneralWeird Shelling Issue inside and out of IDE Pin
CyberTech13-Apr-05 7:34
CyberTech13-Apr-05 7:34 
GeneralRe: Weird Shelling Issue inside and out of IDE Pin
Dave Kreskowiak13-Apr-05 7:52
mveDave Kreskowiak13-Apr-05 7:52 
GeneralRe: Weird Shelling Issue inside and out of IDE Pin
CyberTech13-Apr-05 8:00
CyberTech13-Apr-05 8:00 
GeneralRe: Weird Shelling Issue inside and out of IDE Pin
Dave Kreskowiak13-Apr-05 8:40
mveDave Kreskowiak13-Apr-05 8:40 
GeneralRe: Weird Shelling Issue inside and out of IDE Pin
CyberTech13-Apr-05 8:46
CyberTech13-Apr-05 8:46 
GeneralRe: Weird Shelling Issue inside and out of IDE Pin
Dave Kreskowiak13-Apr-05 9:13
mveDave Kreskowiak13-Apr-05 9:13 
GeneralC# WinForm - HTML Browser Pin
AnneThorne13-Apr-05 6:49
AnneThorne13-Apr-05 6:49 
GeneralRe: C# WinForm - HTML Browser Pin
Dave Kreskowiak13-Apr-05 7:48
mveDave Kreskowiak13-Apr-05 7:48 
GeneralRe: C# WinForm - HTML Browser Pin
AnneThorne13-Apr-05 7:50
AnneThorne13-Apr-05 7:50 
GeneralC# DataRelation Pin
elapid13-Apr-05 6:45
elapid13-Apr-05 6:45 
GeneralRe: C# DataRelation Pin
turbochimp13-Apr-05 6:54
turbochimp13-Apr-05 6:54 
GeneralC# & Crystal Reports Pin
JRGuerrero13-Apr-05 5:50
JRGuerrero13-Apr-05 5:50 
GeneralOutput Type of Class library can not be started directly Pin
LiamD13-Apr-05 5:49
LiamD13-Apr-05 5:49 
GeneralRe: Output Type of Class library can not be started directly Pin
turbochimp13-Apr-05 6:49
turbochimp13-Apr-05 6:49 
GeneralRe: Output Type of Class library can not be started directly Pin
LiamD13-Apr-05 23:58
LiamD13-Apr-05 23:58 
GeneralRe: Output Type of Class library can not be started directly Pin
turbochimp14-Apr-05 2:34
turbochimp14-Apr-05 2:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.