IS it possible to block message Box from Existing DLL?

。_饼干妹妹 提交于 2019-12-11 00:27:45

问题


I am working with C# winforms Application i am dll in my project when call that function from that dll i get unwanted MessageBox from that .Is it possible to block that MessageBox?


回答1:


If push comes to shove, you can fire up a thread that kills off any open windows by title using WinAPI or libraries.

I'd resort to less harsh mechanisms like changing the dll first or putting a change req to the right people.




回答2:


There is no nice option to get rid of the message box if this is a third-party dll.

However, as C# is compiled to IL you can view the byte code and remove the call to MessageBox.Show or replace it with a call to Trace.WriteLine. You can do this e.g. using the ildasm.exe/ilasm.exe tools coming with the SDK.




回答3:


You can study that dll with hex-editor, debugger or some resource viewer to find out how dialog box is created and then subscribe to that Windows event (Like OnCreate - surf WinAPI docs for info on Windows creation functions). In your event handler try to suppress dialog box and see if dll function is happy about the fact that dialog wasn't shown




回答4:


If your dll is managed code you can decompile it and remove MessageBox call like 0xA3 suggested. If your dll is native you can use API hooking. Example of WinAPI hooking you can find here. It's in C++, but can be easily translated to C#.



来源:https://stackoverflow.com/questions/4657606/is-it-possible-to-block-message-box-from-existing-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!