How to kill an unmanaged message box call from a service
I have a service that makes a c开发者_运维知识库all to an unmanaged dll. On a certain code path, it will open a message box. Since it's a service, there's no actual window that shows up, but the thread is still blocked.
How do I kill that message box automatically?
Actually the message box is displayed, but not on the interactive window stations and thus isn't visible to any logged on user. You have a few options:
You can make the service interactive. This will allow it to show a message box to the user currently logged on. MSDN has some information about interactive services.
You can hook the MessageBox export and redirect it to your own code. This can be done using low level Windows API functions.
精彩评论