kill window

K

Konrad

Hi

How to kill some window from the same application
but from other thread having name of this window?

Thanks Konrad
 
J

Jerry Ham

You may want to structure the application so that the thread knows more
about the window than just the name.

However, with just the name, you could certainly use P/Invoke.

FindWindow to get the handle to the window, then
SendMessage to send a WM_CLOSE to the window

Jerry
 
H

Herfried K. Wagner [MVP]

* "Konrad said:
How to kill some window from the same application
but from other thread having name of this window?

What's the "name" of the window?
 
Y

Ying-Shen Yu[MSFT]

Hi Konrad,

Since it's in the same application, you may pass in your Form reference to
your thread, and call the close <form>.Invoke(new
MethodInvoker(<form>.Close()));
You need call Form.Close by Control.Invoke method, because it's not
recommended to operate GUI on another thread.


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Threads 1
prevent from refresh 4
window invisible 2
Can't delete file 3
internet connection 3
Special UV light safely kills airborne flu virus 10
Change assembly name 3
Problem with Kill Syntax! 1

Top