Click here to Skip to main content
15,895,423 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how can i add image/file icon in listview? Pin
amitmistry_petlad 19-Feb-07 22:57
amitmistry_petlad 19-Feb-07 22:57 
QuestionProblem in using 'GlobalMemoryStatusEx' Pin
SelvaKr19-Feb-07 16:21
SelvaKr19-Feb-07 16:21 
AnswerRe: Problem in using 'GlobalMemoryStatusEx' Pin
David Crow19-Feb-07 16:55
David Crow19-Feb-07 16:55 
GeneralRe: Problem in using 'GlobalMemoryStatusEx' Pin
SelvaKr19-Feb-07 17:11
SelvaKr19-Feb-07 17:11 
Questionproblem with IWbemClassObject::GetMethod Pin
Manasi D19-Feb-07 16:03
Manasi D19-Feb-07 16:03 
AnswerRe: problem with IWbemClassObject::GetMethod Pin
redr0cky25-Jul-10 22:10
redr0cky25-Jul-10 22:10 
AnswerRe: Do the Visual C++6 and MFC can develope application to install on.. Pin
David Crow19-Feb-07 16:41
David Crow19-Feb-07 16:41 
QuestionSEH exception translation bug Pin
jfranzoy19-Feb-07 14:14
jfranzoy19-Feb-07 14:14 
Hi.

I am having a problem with the translation of SEH exceptions into c++ exceptions using visual studio 2005. In the release version it doesn't work, if I disable the optimization (/Od) it works!

Had anybody experience this problem? I really would like a solution or workaround to this.

Thanks.

What follows is a simple demo program:
// set_se_translator.cpp
// compile with: /clr /EHa
#include
#include
#include
using namespace std;

#using
using namespace System;

#define MYEXCEPTION_CODE 0xe0000101

class CMyException
{
public:
unsigned int m_ErrorCode;
EXCEPTION_POINTERS* m_pExp;
CMyException() : m_ErrorCode(0), m_pExp(NULL) {}
CMyException(unsigned int i, EXCEPTION_POINTERS* pExp)
: m_ErrorCode(i), m_pExp(pExp) { }
CMyException(CMyException& c)
: m_ErrorCode(c.m_ErrorCode), m_pExp(c.m_pExp) { }
friend ostream& operator<<(ostream& out, const CMyException& inst)
{
return out << "CMyException[\n" << "Error Code: " << inst.m_ErrorCode << "]";
}
};

void my_trans_func(unsigned int u, PEXCEPTION_POINTERS pExp)
{
cout << "In my_trans_func.\n";
throw CMyException( u, pExp );
}

#pragma managed
void managed_func(void)
{
printf("managed_func\n");
try
{
//RaiseException(MYEXCEPTION_CODE, 0, 0, 0);
int i = 0;
i = 1/i;
}
catch(CMyException x)
{
// This is not printed, ok: it is managed code
printf("managed_func: Caught an SEH exception with exception code: %x\n",
x.m_ErrorCode);
}
catch(...)
{
// This messaeg is printed
printf("managed_func: This is invoked since _set_se_translator is not supported when /clr is used\n");
}
}

#pragma unmanaged
void unmanaged_func(void)
{
printf("unmanaged_func\n");
try
{
//RaiseException(MYEXCEPTION_CODE, 0, 0, 0);
int i = 0;
i = 1/i;
}
catch(CMyException x)
{
// This is not printed!!!
printf("unmanaged_func: Caught an SEH exception with exception code: %x\n",
x.m_ErrorCode);
}
catch(...) {
// Neither do this!!!
printf("unmanaged_func: ugh\n");
}
}

int main(int argc, char** argv)
{
_set_se_translator(my_trans_func);
// It does not matter whether the translator function
// is registered in managed or unmanaged code
managed_func();
unmanaged_func();
return 0;
}

Juan Carlos Franzoy

Juan Carlos Franzoy

AnswerRe: SEH exception translation bug Pin
Mark Salsbery20-Feb-07 6:42
Mark Salsbery20-Feb-07 6:42 
QuestionC++ Email project help Pin
arbster119-Feb-07 12:50
arbster119-Feb-07 12:50 
AnswerRe: C++ Email project help Pin
David Crow21-Feb-07 8:21
David Crow21-Feb-07 8:21 
QuestionMFC Force Painting Pin
Bram van Kampen19-Feb-07 12:49
Bram van Kampen19-Feb-07 12:49 
AnswerRe: MFC Force Painting [modified] Pin
Mark Salsbery19-Feb-07 13:06
Mark Salsbery19-Feb-07 13:06 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 13:46
Bram van Kampen19-Feb-07 13:46 
GeneralRe: MFC Force Painting Pin
Mark Salsbery19-Feb-07 13:53
Mark Salsbery19-Feb-07 13:53 
GeneralRe: MFC Force Painting [modified] Pin
Bram van Kampen19-Feb-07 15:16
Bram van Kampen19-Feb-07 15:16 
GeneralRe: MFC Force Painting Pin
PJ Arends19-Feb-07 15:51
professionalPJ Arends19-Feb-07 15:51 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 16:04
Bram van Kampen19-Feb-07 16:04 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 5:21
Mark Salsbery20-Feb-07 5:21 
GeneralRe: MFC Force Painting Pin
Bram van Kampen20-Feb-07 13:23
Bram van Kampen20-Feb-07 13:23 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 13:30
Mark Salsbery20-Feb-07 13:30 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 5:41
Mark Salsbery20-Feb-07 5:41 
GeneralRe: MFC Force Painting Pin
Bram van Kampen20-Feb-07 12:14
Bram van Kampen20-Feb-07 12:14 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 12:31
Mark Salsbery20-Feb-07 12:31 
GeneralRe: MFC Force Painting [modified] Pin
Mark Salsbery20-Feb-07 14:06
Mark Salsbery20-Feb-07 14:06 

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.