Close application from dll?
- hi
i have a dll file and i need to use it to close/exit/shutdown the application thats using it if that makes sense. i can code something inside the main application that would close it if it receives a specific response from the dll but im trying to minimize the amount of code i need to use within the main application.
could someone please show me how i could shutdown the application from the dll?
thank you so much x
Answers
- What I'd do is add an event in the dll that it raises when it wants the application to close. Then add an event handler in the application, and close the application in that event.
There are "issues" that may need to be addressed, such as open files, databases, etc., so you need to consider all of the ramifications of this operation. This doesn't sound very user friendly, but... I suppose "friendly" may not be the goal?
Dick
Dick Grier, MVP. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net.- Proposed As Answer byRudedog2 Wednesday, November 04, 2009 5:46 PM
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 2:02 AM
- Post a WM_QUIT message to its message queue, using PostMessage.
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 2:02 AM
All Replies
- What I'd do is add an event in the dll that it raises when it wants the application to close. Then add an event handler in the application, and close the application in that event.
There are "issues" that may need to be addressed, such as open files, databases, etc., so you need to consider all of the ramifications of this operation. This doesn't sound very user friendly, but... I suppose "friendly" may not be the goal?
Dick
Dick Grier, MVP. Author of Visual Basic Programmer's Guide to Serial Communications 4. See www.hardandsoftware.net.- Proposed As Answer byRudedog2 Wednesday, November 04, 2009 5:46 PM
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 2:02 AM
- Post a WM_QUIT message to its message queue, using PostMessage.
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 2:02 AM


