I can detect another instance of an application running by using App.PrevInstance, is there a way to force that other instance of the application to shut down?
No time to post an example right now but, I believe you can use the PostMessage API, passing WM_CLOSE (&H10) for the wMsg parameter. Use EnumWindows along with a callback function that uses GetWindowTextLength and GetWindowText to identify and acquire a handle for the appropriate window.
There may be a better (safer) way to identify the correct window but I don't know what it is.
We've covered this in the past. Try doing a keyword search in this forum. If you can't find anything just shout and I'm sure we'll be able to help out.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.