Question: I have a textbox and a button with an onClick event connected to it, and when the button is clicked once I want to change the text of the button and clear the textbox. How can i accomplish this?

Answer: 
With C++11 we could use:

```
std::exception_ptr active_exception;

try
{
    // call code which may throw exceptions
}
catch (...)
{
    // an exception is thrown. save it for future re-throwing.
    active_exception = std::current_exception();
}

// call C code
...

// back to C++, re-throw the exception if needed.
if (active_exception)
    std::rethrow_exception(active_exception);

```

Before C++11 these can still be used via [Boost Exception](http://www.boost.org/doc/libs/1_48_0/libs/exception/doc/boost-exception.html).
Some environments support this more or less directly.

For instance, if you enable [structured exception handling](http://msdn.microsoft.com/en-us/library/windows/desktop/ms680657(v=vs.85).aspx) and C++ exceptions through the [`/EH`](http://msdn.microsoft.com/en-us/library/1deeycx5(VS.71).aspx) compiler switch, you can have C++ exceptions implemented over Microsoft's structured exception handling ("exceptions" for C). Provided these options are set when compiling all your code (the C++ at each end and the C in the middle) stack unwinding will "work".

**However, this is almost always a Bad Idea (TM).** Why, you ask? Consider that the piece of C code in the middle is:

```
WaitForSingleObject(mutex, ...);
invoke_cxx_callback(...);
ReleaseMutex(mutex);

```

And that the `invoke_cxx_callback()` (....drum roll...) invokes your C++ code that throws an exception. You will leak a mutex lock. Ouch.

You see, the thing is that most C code is not written to handle C++-style stack unwinding at any moment in a function's execution. Moreover, it lacks destructors, so it doesn't have [RAII](http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization) to protect itself from exceptions.

[Kenny TM](https://stackoverflow.com/a/9252210/313063) has a solution for C++11 and Boost-based projects. [xxbbcc](https://stackoverflow.com/a/9252216/313063) has a more general, albeit more tedious solution for the general case.