Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I customize "%s has encountered a problem and needs to close"?

Every Windows developer is all too familiar with an alert of the form:

Foo.exe has encountered a problem and needs to close.

I am resigned to my apps blowing up from time to time (only during development of course), but when they do, I don't want to see "Foo.exe" here. I want to see a "friendly" name such as "FooBrowser™".

I've searched the MSDN documentation high and low for a way to override this string and not found it. And I've conducted lots of experiments to see if I could stumble across the mechanism without any luck. However, when I search the web for "has encountered a problem and needs to close", I see lots of folks discussing instances preceded by a friendly name, and I doubt they're all replacing the entire alert with their own. :-)

I need this to work for native Win32 applications; .NET ain't an option. The set of examples I see discussed on the web includes Microsoft Internet Explorer (a native app) and Microsoft Works (which I assume is still a native app although it's been four eons since I saw it).

What's the secret handshake?

like image 932
Integer Poet Avatar asked Dec 11 '09 00:12

Integer Poet


3 Answers

I'm not sure exactly what version of Windows you are targeting, but newer ones will try to use the friendly product name when you crash.

Make sure you add a version resource to your executable, and provide a friendly product name and file name, in the FileDescription string.

This page on MSDN provides more information.

like image 128
Michael Avatar answered Oct 17 '22 09:10

Michael


My understanding is that once your exception bubbles up to the OS, you're out of luck. My approach would be to catch the exception before it reaches the OS. In my applications, I have a form that I show when I have an unhandled exception that allows the user to submit bug reports, preventing the OS from showing the form you're talking about.

Just a different perspective :)

like image 23
Charlie Salts Avatar answered Oct 17 '22 08:10

Charlie Salts


Why not just rename your application executable FooBrowser™.exe?

like image 1
Roddy Avatar answered Oct 17 '22 07:10

Roddy