It is necessary to send a completion signal to the window. It is the signal of completion, the process of killing will not go - there are several of them, and 2-3 windows work right away, 2-3 processes are not closed.
3 answers
Provided that you have the handle of the window that you are trying to close, sending WM_CLOSE will work
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(IntPtr handle, UInt32 message, IntPtr w, IntPtr l); static uint WM_CLOSE = 0x10; public void CloseWindow(IntPtr handle) { SendMessage(handle, WM_CLOSE, IntPtr.Zero, IntPtr.Zero); }
- I'm going to try now. - Roan
- Yes, thanks, it helped. - Roan
|
A specific window inside an application in WPF closes like this:
foreach (Window window in Application.Current.Windows ) { if (window.Name = "...") { window.Close(); } }
- "Application.Current.Windows" Application does not exist in the current context, clicked "allow", in options only "System.Net.Mime.MediaTypeNames.Application", and that does not fit. - Roan
- So, the application is not WPF, console. Maybe alternatives? - Roan
|
Chet said this, mosh break?))
setVisible(false);
- I asked to close the window, not to make it invisible. Window - batch file that starts a java-application, you need to send a completion signal. - Roan
- How should this help? - Maxim Kamalov
|