I am having trouble with a program that I am writing. I cannot seem to be able to destroy a window. I know the DestroyWindow function but it only works on windows that my application owns. Is there any way to destroy a window that is not owned by my application using windows API? (I was thinking of maybe writing some kind of keysym function that would press ALT-TAB then check the window name, then press ALT-F4 if necessary)

SendMessage(FindWindow("WindowClass", "windowname"), WM_CLOSE, 0);

Or PostMessage which does not wait to return.

Thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.