First-chance exception at 0x7c812a5b in : Microsoft C++ exception: CError at memory location

If you are programming and you have some calls to ShellExceute in your code, and you are debugging, you might see this fly across the output window

First-chance exception at 0x7c812a5b in : Microsoft C++ exception: CError at memory location

The app will be your exe name, and location will be a memory location.

You can reproduce this by calling ShellExecute with a url as the file param like so:

ShellExecute(NULL, “open”, “” , NULL, NULL, SW_SHOWNORMAL);

You should have a path to a file, but what Windows does is look for the http:// or .com and then does a lookup in the registry for the default handler, which more than likely is Internet Explorer, or Firefox, or whatever is your default browser. More info here

INFO: Use ShellExecute to Launch the Default Web Browser KB 224816

I haven’t tried catching the exception, but I can’t figure out a way to get rid of it. It doesn’t seem to hurt anything and actually doesn’t throw up an error. Just an annoying little quirk in Windows and C++.

I did a little digging on Google and didn’t seem to find any more info, so I guess it isn’t a huge deal. Ahh, the mystery of Windows!!!

By Steve Novoselac

Director of Digital Technology @TrekBikes, Father, Musician, Cyclist, Homebrewer

3 replies on “First-chance exception at 0x7c812a5b in : Microsoft C++ exception: CError at memory location”

This one isn’t much of a mystery. The output window tells you when anything happens (a library is loaded, an exception happens, whatever). But what it tells doesn’t necessarily mean there’s a problem. In this case, what’s happening is that an exception is being raised and caught. The output window tells you about the exception being raised, and the fact that the app doesn’t crash tells you that it’s being caught and handled.


I think the exception is a CError (looks that way from the output you pasted), and as for why, it’s probably an internal exception that they use for logic flow control (but that’s just guess work).


Leave a Reply to Steve Novoselac Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.