Using MFC Exceptions in Console Applications


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Using MFC Exceptions in Console Applications

  1. #1
    Greg Guest

    Using MFC Exceptions in Console Applications


    I have a test program that uses the CFile class. When it fails to open a file
    (ie. when I have locked the file), it returns false. The error information
    is given to me in a CFileException object. When I try to format the message
    for this exception, an assertion is thrown because my program does not have
    a resource handle.

    I am assuming it is because I am using a console application, but how can
    I use the MFC exception frameowrk from my console application.

    Greg

  2. #2
    Danny Kalev Guest

    Re: Using MFC Exceptions in Console Applications

    why would you want to use MFC in a console app in the first place? I
    suggest that you use fstream objects instead and standard exception
    handling.

    Danny

    Greg wrote:
    >
    > I have a test program that uses the CFile class. When it fails to open a file
    > (ie. when I have locked the file), it returns false. The error information
    > is given to me in a CFileException object. When I try to format the message
    > for this exception, an assertion is thrown because my program does not have
    > a resource handle.
    >
    > I am assuming it is because I am using a console application, but how can
    > I use the MFC exception frameowrk from my console application.
    >
    > Greg


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center