Suppress / Mute windows crash message box

2019-09-09 02:27发布

I have a problem with ActiveState Perl interpreter for windows. It occassionaly crashes. I need to know how to get rid of this message box:

[ Perl Command Line Interpreter                           ]

Perl Command Line Interpreter has stopped working

A problem caused the program to stop working correctly.
Windows will close the program and notify you if a solution
is available.

                                            [Close Program]

I just want it to die silently, so I can restart it automatically. How to suppress that message box?

1条回答
Animai°情兽
2楼-- · 2019-09-09 03:11

Try https://metacpan.org/module/Win32API::File#SetErrorMode

This provokes a crash and pops up a dialog

perl -MWx -le "  Wx::Font->new(undef) "

This provokes a crash and pops up a dialog (perl.exe has encountered a problem and needs to close.)

perl -MWin32API::File -MWx -le "  Win32API::File::SetErrorMode(2); Wx::Font->new(undef) "

So it seems to work, and Win32API::File comes standard since v5.8.9

update: Another test/demo, Wx-free, not fixed yet

perl -e " use open qw{:encoding(UTF-8) :std}; fork; " 
perl -MWin32API::File -le "  Win32API::File::SetErrorMode(2); use open qw{:encoding(UTF-8) :std}; fork; " 
查看更多
登录 后发表回答