Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to kill HWND ? #42

Open
wilon opened this issue Feb 1, 2018 · 2 comments
Open

How to kill HWND ? #42

wilon opened this issue Feb 1, 2018 · 2 comments

Comments

@wilon
Copy link

wilon commented Feb 1, 2018

hwnd := win.FindWindow(nil, syscall.StringToUTF16Ptr("someApp"))
// I want to kill hwnd, how?
@krpors
Copy link
Contributor

krpors commented Apr 18, 2018

Have you tried

win.SendMessage(hwnd, win.WM_CLOSE, 0, 0)

?

@StephanVerbeeck
Copy link

StephanVerbeeck commented Apr 2, 2019

It might be prudent to use the non-blocking variant

win.PostMessage(yourHWND, win.WM_CLOSE, 0, 0)

The program you are trying to close might open a popup dialog (e.g. requesting to save the modified document it was showing) and that will block your program!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants