Click here to Skip to main content
16,015,097 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ATL/COM + MFC: Dialogs? - this is very long message Pin
Martin Ziacek27-May-02 8:38
Martin Ziacek27-May-02 8:38 
GeneralReturning a refrence from a function Pin
Abhishek Narula27-May-02 0:08
Abhishek Narula27-May-02 0:08 
GeneralRe: Returning a refrence from a function Pin
markkuk27-May-02 0:18
markkuk27-May-02 0:18 
GeneralRe: Returning a refrence from a function Pin
Abhishek Narula27-May-02 0:25
Abhishek Narula27-May-02 0:25 
GeneralRe: Returning a refrence from a function Pin
Joaquín M López Muñoz27-May-02 0:14
Joaquín M López Muñoz27-May-02 0:14 
GeneralRe: Returning a refrence from a function Pin
Abhishek Narula27-May-02 0:24
Abhishek Narula27-May-02 0:24 
GeneralRe: Returning a refrence from a function Pin
Joaquín M López Muñoz27-May-02 0:28
Joaquín M López Muñoz27-May-02 0:28 
GeneralRe: Returning a refrence from a function Pin
Alexandru Savescu27-May-02 1:17
Alexandru Savescu27-May-02 1:17 
It goes like this:

1. Create a class CMyException. Here is an example:
class CMyException
{
  CString strError;
public:
  CMyException (CString& a) : strError (a) {} 
  void HandleError ()
  {
    AfxMessageBox (strError);
  }
}


2. Do this in that function:
if (index_is_out_of_bounds)
  throw CMyException ("Index out of bounds"); // throw the exception


3. Catch the exception like this:
try
{
  // call the function that may throw the exception
}
catch (CMyException& e)
{
  // caught an exception and now handle it
  e.HandleError ();
  return;
}


You can also check MSDN for details or download a good C++ book. "Thinking in C++" from www.bruceeckel.com


Best regards,
Alexandru Savescu
GeneralSetting up Size for CFormView Pin
sanskypotov27-May-02 0:00
sanskypotov27-May-02 0:00 
GeneralRe: Setting up Size for CFormView Pin
Joaquín M López Muñoz27-May-02 0:00
Joaquín M López Muñoz27-May-02 0:00 
GeneralRe: Setting up Size for CFormView Pin
Roger Allen27-May-02 4:51
Roger Allen27-May-02 4:51 
GeneralDdeClientTransaction() problem.. Pin
Neha26-May-02 23:38
Neha26-May-02 23:38 
Questionlooks good? Pin
Nnamdi Onyeyiri26-May-02 23:25
Nnamdi Onyeyiri26-May-02 23:25 
AnswerRe: looks good? Pin
Paul M Watt27-May-02 6:04
mentorPaul M Watt27-May-02 6:04 
AnswerRe: looks good? Pin
Ed Gadziemski1-Jun-02 11:44
professionalEd Gadziemski1-Jun-02 11:44 
QuestionInsert and eject cd-rom by sendaspi32command? Pin
chen26-May-02 21:11
chen26-May-02 21:11 
AnswerRe: Insert and eject cd-rom by sendaspi32command? Pin
Mike Nordell27-May-02 21:14
Mike Nordell27-May-02 21:14 
GeneralBMP - GIF Pin
Sameer Maggon26-May-02 21:06
Sameer Maggon26-May-02 21:06 
GeneralRe: BMP - GIF [corrected] Pin
Joaquín M López Muñoz27-May-02 0:17
Joaquín M López Muñoz27-May-02 0:17 
GeneralRe: BMP - GIF [corrected] Pin
Sameer Maggon27-May-02 0:54
Sameer Maggon27-May-02 0:54 
GeneralRe: BMP - GIF [corrected] Pin
Joaquín M López Muñoz27-May-02 2:42
Joaquín M López Muñoz27-May-02 2:42 
GeneralISO9660 FS Pin
yamini26-May-02 20:47
yamini26-May-02 20:47 
GeneralRe: ISO9660 FS Pin
Mike Nordell27-May-02 21:26
Mike Nordell27-May-02 21:26 
GeneralRe: ISO9660 FS Pin
yamini27-May-02 23:47
yamini27-May-02 23:47 
GeneralRe: ISO9660 FS Pin
yamini27-May-02 23:47
yamini27-May-02 23:47 

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.