Hi,
The problem :
Have a system tray application.This has a menu item 'Exit'.
On click of this a differnt application with a UI which runs in the
background should close.
The other application requires a Keyboard combination of Ctrl + Shift + Alt
+ X to close it properly.
After closing the other application the tray app should exit. (Process.Kill
cannot be used)
The following code doesnt work all the times.
Any Ideas.
Thanks in advance
------
//
//[DllImport("user32.dll")] public static extern int FindWindow(string
lpClassName,string lpWindowName);
int handle = Win32.FindWindow(null,"Basic Service");
//[DllImport("user32.dll")]public static extern bool SetForegroundWindow(int
hWnd);
Win32.SetForegroundWindow(handle);
handle = Win32.FindWindow(null,"Basic Service");
//[DllImport("user32.dll")]public static extern bool SetActiveWindow(int
hWnd);
Win32.SetActiveWindow(handle);
SendKeys.SendWait("+^%(x)");
processor.EndTasks();
noiIcon.Visible = false;
this.Close();
------------------------------
Jakob Christensen - 09 Aug 2005 07:33 GMT
It is probably not a good idea to rely on using SendKeys.
Process.CloseMainWindow is the correct way to close another process. This
will cause the message WM_QUIT to be send to the window of the other process
which is similar to having the user closing the application manually.
HTH, Jakob.

Signature
http://www.dotninjas.dk
http://www.powerbytes.dk
> Hi,
>
[quoted text clipped - 37 lines]
>
> ------------------------------