Click here to Skip to main content
16,020,305 members
Home / Discussions / C#
   

C#

 
GeneralRe: socket timeout Pin
Daniel Turini23-Sep-02 9:16
Daniel Turini23-Sep-02 9:16 
GeneralRe: socket timeout Pin
Rüpel23-Sep-02 10:09
Rüpel23-Sep-02 10:09 
Generalstill doesn't work Pin
Rüpel23-Sep-02 20:52
Rüpel23-Sep-02 20:52 
Generalfinally Pin
Rüpel23-Sep-02 21:53
Rüpel23-Sep-02 21:53 
GeneralEiffel .NET for Visual Studio .NET Plug-in Pin
Kevin McFarlane20-Sep-02 1:50
Kevin McFarlane20-Sep-02 1:50 
GeneralBackground and foreground color for disabled state Pin
valos20-Sep-02 1:18
valos20-Sep-02 1:18 
QuestionShut down one program from another? Pin
Matt Philmon19-Sep-02 18:11
Matt Philmon19-Sep-02 18:11 
AnswerRe: Shut down one program from another? Pin
Stephane Rodriguez.19-Sep-02 19:08
Stephane Rodriguez.19-Sep-02 19:08 
Here is the .NET framework code for WaitForExit() :
public bool WaitForExit(int milliseconds) {
	IntPtr local0;
	bool local1;
	int local2;

	local0 = 20315E582031596Cop_Explicit20315970020315968;
	try {
		local0 = this.GetProcessHandle(1048576, false);
		if (20315E58local0 == NativeMethods.INVALID_HANDLE_VALUE20315968)
			local1 = true;
		else {
			local2 = NativeMethods.WaitForSingleObject(local0, milliseconds);
			if (local2 == 0)
				local1 = true;
			else {
				if (local2 == 258)
					local1 = false;
				else
					throw new Win32Exception();
			}
		}
	}
	finally {
		this.ReleaseProcessHandle(local0);
	}
	if (local1 && this.watchForExit)
		this.RaiseOnExited();
	return local1;
}


Here is the .NET framework code for Kill() :
public void Kill() {
	IntPtr local0;

	local0 = 20315E582031596Cop_Explicit20315970020315968;
	try {
		local0 = this.GetProcessHandle(1);
		if (!(NativeMethods.TerminateProcess(local0, -1)))
			throw new Win32Exception();
	}
	finally {
		this.ReleaseProcessHandle(local0);
	}
}


All in all this looks pretty much like it was coded using raw WIN32. To better kill, may be it makes sense to send the WM_QUIT message to the application :

Declaration :
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);


Usage :
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public const int WM_QUIT = 0x0012;
NativeWIN32.SendMessage( hWnd, WM_QUIT, 0, 0);

or

NativeWIN32.SendMessage(hWnd, NativeWIN32.WM_SYSCOMMAND, NativeWIN32.SC_CLOSE, IntPtr.Zero);




MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
GeneralRe: Shut down one program from another? Pin
Matt Philmon19-Sep-02 20:50
Matt Philmon19-Sep-02 20:50 
GeneralRe: Shut down one program from another? Pin
Stephane Rodriguez.19-Sep-02 21:23
Stephane Rodriguez.19-Sep-02 21:23 
GeneralRe: Shut down one program from another? Pin
Matt Philmon20-Sep-02 4:47
Matt Philmon20-Sep-02 4:47 
GeneralRe: Shut down one program from another? Pin
leppie20-Sep-02 5:22
leppie20-Sep-02 5:22 
GeneralRe: Shut down one program from another? Pin
Matt Philmon20-Sep-02 21:33
Matt Philmon20-Sep-02 21:33 
GeneralRe: Shut down one program from another? Pin
Stephane Rodriguez.21-Sep-02 1:52
Stephane Rodriguez.21-Sep-02 1:52 
GeneralRe: Shut down one program from another? Pin
leppie21-Sep-02 2:01
leppie21-Sep-02 2:01 
GeneralRe: Shut down one program from another? Pin
Matt Philmon21-Sep-02 5:49
Matt Philmon21-Sep-02 5:49 
GeneralBeta of .NET Framework Version 1.1 now available Pin
Eric Gunnerson (msft)19-Sep-02 12:30
Eric Gunnerson (msft)19-Sep-02 12:30 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
David Stone19-Sep-02 13:11
sitebuilderDavid Stone19-Sep-02 13:11 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
Eric Gunnerson (msft)23-Sep-02 7:30
Eric Gunnerson (msft)23-Sep-02 7:30 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
Matt Philmon20-Sep-02 21:34
Matt Philmon20-Sep-02 21:34 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
James T. Johnson21-Sep-02 2:07
James T. Johnson21-Sep-02 2:07 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
leppie21-Sep-02 2:06
leppie21-Sep-02 2:06 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
David Stone21-Sep-02 5:26
sitebuilderDavid Stone21-Sep-02 5:26 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
leppie21-Sep-02 5:50
leppie21-Sep-02 5:50 
GeneralRe: Beta of .NET Framework Version 1.1 now available Pin
David Stone21-Sep-02 10:57
sitebuilderDavid Stone21-Sep-02 10:57 

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.