troubleshooting Question

SendMessage WM_CLOSE to another process

Avatar of raheelasadkhan
raheelasadkhanFlag for Pakistan asked on
3 Comments1 Solution13398 ViewsLast Modified:
I'm trying to use the SendMessage function to send the WM_CLOSE message to an external process. Even though the call returns 0, nothing happens and the target window does not close.

public const int WM_CLOSE = 0x10;
[DllImport("user32", EntryPoint="SendMessageA")]
public static extern Int32 SendMessage(Int32 hwnd, Int32 wMsg, Int32 wParam, Int32 lParam);

int result = WindowsEnumerator.SendMessage (hWnd, WM_CLOSE, 0, 0);

Is there something else I need to do to make the call valid for an external process?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros