Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC Exceptions Pin
rrrado11-Jul-09 5:22
rrrado11-Jul-09 5:22 
AnswerRe: MFC Exceptions Pin
Stuart Dootson11-Jul-09 5:36
professionalStuart Dootson11-Jul-09 5:36 
GeneralRe: MFC Exceptions Pin
rrrado11-Jul-09 6:23
rrrado11-Jul-09 6:23 
GeneralRe: MFC Exceptions Pin
Stuart Dootson11-Jul-09 7:20
professionalStuart Dootson11-Jul-09 7:20 
GeneralRe: MFC Exceptions Pin
rrrado11-Jul-09 8:05
rrrado11-Jul-09 8:05 
GeneralRe: MFC Exceptions Pin
rrrado11-Jul-09 9:34
rrrado11-Jul-09 9:34 
GeneralRe: MFC Exceptions Pin
Stuart Dootson11-Jul-09 9:43
professionalStuart Dootson11-Jul-09 9:43 
GeneralRe: MFC Exceptions Pin
Stuart Dootson11-Jul-09 10:02
professionalStuart Dootson11-Jul-09 10:02 
If I'd thought a bit more, I'd have realised that could never work for various reasons. However, this suggestion does let you intercept AfxThrowInvalidArgException:

  1. BEFORE you #include any MFC headers (so put this in your stdafx.h), add this:

    #define AfxThrowInvalidArgException MyThrowInvalidArgException
  2. Now add this code at the end of one of your .cpp files, changing the body to suit what you want to do
    void __stdcall MyThrowInvalidArgException()
    {
       // Whoops!
    #undef AfxThrowInvalidArgException
       OutputDebugString(_T("WHOOPS"));
       void __declspec(noreturn) AFXAPI AfxThrowInvalidArgException();
       AfxThrowInvalidArgException();
    }


I've tried this under VS2008 with a simple MFC app and MyThrowInvalidArgException was called when I executed this code:

CArray<int, int> arr;
arr.GetAt(100);


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: MFC Exceptions Pin
rrrado11-Jul-09 19:31
rrrado11-Jul-09 19:31 
QuestionRegarding Created Date Pin
kirankatta11-Jul-09 4:48
kirankatta11-Jul-09 4:48 
AnswerRe: Regarding Created Date Pin
Pardhu_M11-Jul-09 5:23
Pardhu_M11-Jul-09 5:23 
QuestionCoversion of SYSTEMTIME TO FILETIME Pin
Pardhu_M11-Jul-09 2:26
Pardhu_M11-Jul-09 2:26 
AnswerRe: Coversion of SYSTEMTIME TO FILETIME Pin
Stuart Dootson11-Jul-09 2:57
professionalStuart Dootson11-Jul-09 2:57 
GeneralRe: Coversion of SYSTEMTIME TO FILETIME Pin
Pardhu_M11-Jul-09 3:39
Pardhu_M11-Jul-09 3:39 
GeneralRe: Coversion of SYSTEMTIME TO FILETIME Pin
Stuart Dootson11-Jul-09 3:59
professionalStuart Dootson11-Jul-09 3:59 
GeneralRe: Coversion of SYSTEMTIME TO FILETIME Pin
Pardhu_M11-Jul-09 5:19
Pardhu_M11-Jul-09 5:19 
QuestionClipboard [modified] Pin
samira forooghi11-Jul-09 1:42
samira forooghi11-Jul-09 1:42 
QuestionHow to Get the path of Internet Explorer using C++ Pin
tns_ranjith11-Jul-09 0:20
tns_ranjith11-Jul-09 0:20 
AnswerRe: How to Get the path of Internet Explorer using C++ Pin
Stuart Dootson11-Jul-09 1:00
professionalStuart Dootson11-Jul-09 1:00 
GeneralRe: How to Get the path of Internet Explorer using C++ Pin
tns_ranjith11-Jul-09 1:13
tns_ranjith11-Jul-09 1:13 
GeneralRe: How to Get the path of Internet Explorer using C++ Pin
Stuart Dootson11-Jul-09 1:19
professionalStuart Dootson11-Jul-09 1:19 
AnswerRe: How to Get the path of Internet Explorer using C++ Pin
David Crow11-Jul-09 15:54
David Crow11-Jul-09 15:54 
QuestionData population Pin
Chiman110-Jul-09 20:21
Chiman110-Jul-09 20:21 
AnswerRe: Data population Pin
Rajesh R Subramanian10-Jul-09 22:07
professionalRajesh R Subramanian10-Jul-09 22:07 
QuestionVector elements and the heap...or the stack... Pin
Mike the Red10-Jul-09 14:16
Mike the Red10-Jul-09 14:16 

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.