开发者

IS it possible to block message Box from Existing DLL?

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?


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.


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.


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


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#.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜