Click here to Skip to main content
16,006,493 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwhere to get Warning specifier/Warning Number list? Pin
gropex19-Feb-02 20:43
gropex19-Feb-02 20:43 
AnswerRe: where to get Warning specifier/Warning Number list? Pin
Joaquín M López Muñoz19-Feb-02 21:53
Joaquín M López Muñoz19-Feb-02 21:53 
QuestionSomething about TAPI -- call picked up ? Pin
19-Feb-02 20:34
suss19-Feb-02 20:34 
AnswerRe: Something about TAPI -- call picked up ? Pin
Joaquín M López Muñoz19-Feb-02 22:06
Joaquín M López Muñoz19-Feb-02 22:06 
GeneralRe: Something about TAPI -- call picked up ? Pin
manio19-Feb-02 22:12
manio19-Feb-02 22:12 
AnswerRe: Something about TAPI -- call picked up ? Pin
Michael P Butler20-Feb-02 0:08
Michael P Butler20-Feb-02 0:08 
GeneralDeveloping Custom Exception Handler :: C++ Pin
valikac19-Feb-02 19:57
valikac19-Feb-02 19:57 
GeneralRe: Developing Custom Exception Handler :: C++ Pin
Derek Waters19-Feb-02 20:22
Derek Waters19-Feb-02 20:22 
I'm just guessing here, but a simple problem is the fact that you're storing a const char pointer in your exception class.

Regardless of the throw/catch stuff, when you call the exception constructor with the static text, all you're doing is setting your char * to point to the start of the "Error: X equals..." stuff. As soon as that goes out of scope, the memory allocated to the string is destroyed, and your const char * in the exception class will point at garbage.

Instead, either create a new char buffer and copy the string into it, or use a CString instead (it will keep a copy of the string for later use):

class ExceptionHandle 
{ 
public: 
  ExceptionHandle(const char *error) : eMessage(error) {} 
  const char *what()
  { 
    return (LPCTSTR)eMessage; 
  } 

private: 
  CString eMessage; 
}; 



------------------------
Derek Waters
derek@lj-oz.com
GeneralRe: Developing Custom Exception Handler :: C++ Pin
valikac19-Feb-02 20:44
valikac19-Feb-02 20:44 
GeneralRe: Developing Custom Exception Handler :: C++ Pin
Joaquín M López Muñoz19-Feb-02 20:53
Joaquín M López Muñoz19-Feb-02 20:53 
GeneralRe: Developing Custom Exception Handler :: C++ Pin
valikac20-Feb-02 4:11
valikac20-Feb-02 4:11 
GeneralCFile::Duplicate Pin
Le centriste19-Feb-02 14:43
Le centriste19-Feb-02 14:43 
GeneralRe: CFile::Duplicate Pin
Nish Nishant19-Feb-02 15:53
sitebuilderNish Nishant19-Feb-02 15:53 
GeneralAppWizard Pin
blink4me19-Feb-02 13:50
blink4me19-Feb-02 13:50 
GeneralRe: AppWizard Pin
Matt Newman19-Feb-02 15:24
Matt Newman19-Feb-02 15:24 
GeneralActiveX "shim" for a Netscape plugin Pin
David Ness19-Feb-02 11:16
David Ness19-Feb-02 11:16 
GeneralCWnd dynamic creation and deletion problem Pin
yellowine19-Feb-02 10:45
yellowine19-Feb-02 10:45 
GeneralRe: CWnd dynamic creation and deletion problem Pin
Nish Nishant19-Feb-02 15:56
sitebuilderNish Nishant19-Feb-02 15:56 
GeneralRe: CWnd dynamic creation and deletion problem Pin
yellowine20-Feb-02 4:22
yellowine20-Feb-02 4:22 
Generalchanging CView styles Pin
19-Feb-02 10:45
suss19-Feb-02 10:45 
GeneralRe: changing CView styles Pin
Joaquín M López Muñoz19-Feb-02 10:58
Joaquín M López Muñoz19-Feb-02 10:58 
GeneralRe: changing CView styles Pin
19-Feb-02 11:32
suss19-Feb-02 11:32 
GeneralAn icon recieving a file Pin
Optic19-Feb-02 10:10
Optic19-Feb-02 10:10 
GeneralA bit miffed about the doc/view architecture... Pin
funbag19-Feb-02 10:10
funbag19-Feb-02 10:10 
GeneralRe: A bit miffed about the doc/view architecture... Pin
Michael P Butler19-Feb-02 10:33
Michael P Butler19-Feb-02 10:33 

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.