Click here to Skip to main content
15,909,437 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to draw a part of Desktop Pin
21-Nov-01 1:38
suss21-Nov-01 1:38 
AnswerRe: How to draw a part of Desktop Pin
Roger Allen21-Nov-01 7:29
Roger Allen21-Nov-01 7:29 
GeneralCWinApp::OnIdle in Dll - is NOT called Pin
DataPrasad21-Nov-01 1:05
DataPrasad21-Nov-01 1:05 
GeneralRe: CWinApp::OnIdle in Dll - is NOT called Pin
Michael Dunn21-Nov-01 6:20
sitebuilderMichael Dunn21-Nov-01 6:20 
GeneralDialog buttons Pin
et20-Nov-01 23:17
et20-Nov-01 23:17 
GeneralRe: Dialog buttons Pin
Christian Graus21-Nov-01 0:39
protectorChristian Graus21-Nov-01 0:39 
GeneralScope of try...catch constructions (over threads) Pin
EiSl20-Nov-01 21:42
EiSl20-Nov-01 21:42 
GeneralRe: Scope of try...catch constructions (over threads) Pin
Joaquín M López Muñoz20-Nov-01 23:11
Joaquín M López Muñoz20-Nov-01 23:11 
Is it possible to (or 'how to') catch the last throw from the Worker_thread into the Main_thread?

The short answer is no you can't. Exceptions are intrinsically attached to the thread where they're produced, as are the mechanisms of stack unwinding involved.
An uncaught exception is simply swallowed by the system (though it is no good practice to let this happen).
An approach to having uncaught exceptions somewhat notified to the main thread is having a grand wrap-all try-catch in the worker thread that intercepts otherwise uncaught exceptions, translates this to a DWORD and return that result code, which the main thread can access with GetExitCodeThread().
How do you translate exceptions to DWORDs? Depends on what kind of exceptions you're dealing with:
  • If you don't have any a priori idea about the exceptions the worker thread can throw, then there's little you can do except perhaps returning 0 as "everything OK" and some other code for "some exception thrown".
  • If the exceptions are derived from C++ std::exception, which provide a description with method what(), you can store this message in some global table and return a pointer to it.
  • If the exceptions are copyable, you can store the exception objet itself in a table an return a pointer to it. Please note that this requires that the exceptions be of an exact known type, as derived types objects are not handled correctly (they're sliced).
  • Some other ad hoc mechanism. You name it.
Hope this helped.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Scope of try...catch constructions (over threads) Pin
Rui Lopes20-Nov-01 23:15
Rui Lopes20-Nov-01 23:15 
QuestionCFindFile? Pin
20-Nov-01 20:57
suss20-Nov-01 20:57 
AnswerRe: CFindFile? Pin
Rassman20-Nov-01 22:03
Rassman20-Nov-01 22:03 
GeneralOwndraw scrollbars question Pin
Osykin Roman20-Nov-01 20:40
Osykin Roman20-Nov-01 20:40 
GeneralRe: Owndraw scrollbars question Pin
moliate21-Nov-01 5:42
moliate21-Nov-01 5:42 
GeneralRe: Owndraw scrollbars question Pin
Osykin Roman21-Nov-01 11:39
Osykin Roman21-Nov-01 11:39 
GeneralClock display Pin
smeckenfill20-Nov-01 19:34
smeckenfill20-Nov-01 19:34 
GeneralRe: Clock display Pin
Member 2362220-Nov-01 19:53
Member 2362220-Nov-01 19:53 
GeneralRe: Clock display Pin
kakuni27-Nov-01 9:11
kakuni27-Nov-01 9:11 
GeneralRe: Clock display Pin
Andrew Peace21-Nov-01 14:44
Andrew Peace21-Nov-01 14:44 
GeneralRe: Clock display Pin
kakuni27-Nov-01 9:14
kakuni27-Nov-01 9:14 
GeneralCEdit - A Simple Question Pin
Xavier Shay20-Nov-01 19:20
Xavier Shay20-Nov-01 19:20 
GeneralRe: CEdit - A Simple Question Pin
Fredrik Skog3-Dec-01 22:31
Fredrik Skog3-Dec-01 22:31 
Generaldifferent outlook on different pc. Pin
zecodela20-Nov-01 16:41
zecodela20-Nov-01 16:41 
GeneralRe: different outlook on different pc. Pin
Alvaro Mendez20-Nov-01 17:59
Alvaro Mendez20-Nov-01 17:59 
GeneralCode bloat! Pin
Todd Smith20-Nov-01 14:12
Todd Smith20-Nov-01 14:12 
Generalcreating a new doc, the sequel Pin
robbied20-Nov-01 12:51
robbied20-Nov-01 12:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.