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

C / C++ / MFC

 
QuestionShow Bitmap image in CRichEdit Control Pin
Dhiraj kumar Saini2-Nov-08 18:05
Dhiraj kumar Saini2-Nov-08 18:05 
AnswerRe: Show Bitmap image in CRichEdit Control Pin
Hamid_RT2-Nov-08 18:19
Hamid_RT2-Nov-08 18:19 
AnswerRe: Show Bitmap image in CRichEdit Control Pin
enhzflep2-Nov-08 18:21
enhzflep2-Nov-08 18:21 
QuestioncapDriverConnect(hwnd_frame,0) Pin
anilaabc2-Nov-08 17:45
anilaabc2-Nov-08 17:45 
AnswerRe: capDriverConnect(hwnd_frame,0) Pin
Mark Salsbery3-Nov-08 5:42
Mark Salsbery3-Nov-08 5:42 
QuestionHelp for a dummy ! - How do add a Custom Control to my VC++6.0 MFC project. Pin
Neil Urquhart2-Nov-08 5:19
Neil Urquhart2-Nov-08 5:19 
AnswerRe: Help for a dummy ! - How do add a Custom Control to my VC++6.0 MFC project. Pin
Michael Dunn2-Nov-08 8:01
sitebuilderMichael Dunn2-Nov-08 8:01 
QuestionException Handling in Microsoft Visual C++ Express? Pin
Megidolaon2-Nov-08 2:31
Megidolaon2-Nov-08 2:31 
I'm trying to understand exception handling in C++.
void main()
{
	try
	{
		ios_base::open_mode d; 
		ofstream myfile;
		myfile.open ("example.txt", d);
		cout << "No excpetion thrown?" << endl;
		system("Pause");
	}
	catch (exception& e)
	{
		cout << "ERROR:\r\n" << e.what() << endl;
		system("Pause");
	}
}

All I want to do is catch the exception with the general exception class.
I did enable C++ Exceptions in the project properties (/EHsc) but when debugging the exception (uninitialized variable 'd' and there is no file called "example.txt" either) isn't thrown because the application is interrupted by MSVC++.

However, the release build simply executes without any exception at all.

I want to use a general exception to catch all errors, in case something unexpected happens and I don't want to use catch(...) because I want to use the what() function to get some information about the error that occurred.

How would I go about it correctly?
Thanks in advance.
AnswerRe: Exception Handling in Microsoft Visual C++ Express? Pin
Michael Dunn2-Nov-08 8:06
sitebuilderMichael Dunn2-Nov-08 8:06 
GeneralRe: Exception Handling in Microsoft Visual C++ Express? Pin
Megidolaon2-Nov-08 23:00
Megidolaon2-Nov-08 23:00 
GeneralRe: Exception Handling in Microsoft Visual C++ Express? Pin
Michael Dunn3-Nov-08 19:44
sitebuilderMichael Dunn3-Nov-08 19:44 
GeneralRe: Exception Handling in Microsoft Visual C++ Express? Pin
Megidolaon4-Nov-08 6:36
Megidolaon4-Nov-08 6:36 
QuestionVisual Studio crashes Pin
Heptagonal1-Nov-08 23:01
Heptagonal1-Nov-08 23:01 
AnswerRe: Visual Studio crashes Pin
Michael Dunn2-Nov-08 8:08
sitebuilderMichael Dunn2-Nov-08 8:08 
Questionhow to delete icon of tool bar Pin
zhiyuan161-Nov-08 21:11
zhiyuan161-Nov-08 21:11 
AnswerRe: how to delete icon of tool bar Pin
Hamid_RT2-Nov-08 2:42
Hamid_RT2-Nov-08 2:42 
Questionhow to jump to heap to execute code? Pin
Irfan Ul Haq1-Nov-08 19:34
Irfan Ul Haq1-Nov-08 19:34 
AnswerRe: how to jump to heap to execute code? Pin
Michael Dunn2-Nov-08 8:10
sitebuilderMichael Dunn2-Nov-08 8:10 
Questionwant to merge childwindow into the main window Pin
prithaa1-Nov-08 19:22
prithaa1-Nov-08 19:22 
AnswerRe: want to merge childwindow into the main window Pin
Nishad S2-Nov-08 20:07
Nishad S2-Nov-08 20:07 
GeneralRe: want to merge childwindow into the main window Pin
prithaa2-Nov-08 21:43
prithaa2-Nov-08 21:43 
GeneralRe: want to merge childwindow into the main window Pin
Nishad S2-Nov-08 21:52
Nishad S2-Nov-08 21:52 
GeneralRe: want to merge childwindow into the main window Pin
prithaa2-Nov-08 22:00
prithaa2-Nov-08 22:00 
GeneralRe: want to merge childwindow into the main window Pin
Nishad S2-Nov-08 22:50
Nishad S2-Nov-08 22:50 
GeneralRe: want to merge childwindow into the main window Pin
prithaa3-Nov-08 0:20
prithaa3-Nov-08 0:20 

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.