|
|
|
hello everyone,
I've been using C# mostly and now I've to use C++ and I'm a bit stumped by that
try{}
catch(...)
{}
structure. I wanna get the line number and other details of the exception being caught. how can I get that info??
Thanks in advance
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Plain C++ doesn't have the reflection capabilities of C# so what you want to do, to be generic, requires the use of symbolic debug information. In other words you can do this but it's not straight forward and will only work in Debug builds with the PDB available. The full process of turning addresses into line numbers and a great deal more is explained in this book by John Robbins[^] and the associated source code will give you what you need. If you can find John's web site it should all be available for free download.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
ok thanks!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Do the __FILE__ and __LINE__ macros help any?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
__LINE__ macro gives the line in the catch block not the one from where the exception occurs... __FILE__ does give u the file name though
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Rocky# wrote: __LINE__ macro gives the line in the catch block not the one from where the exception occurs
Right. That's about all you get. You can always throw an exception that contains
useful source information, including using those macros.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Can any one tell me how to differentiate messagebox dialog from other dialogs.
Thanks in advance.
|
|
|
|
|
why do you have any of your dialogs which look like messagebox?
|
|
|
|
|
As the MessageBox comes from CWnd and CDialog is a CWnd derived class but "independant" you can try
CDialog* pDlg = (CDialog*) GetActiveWindow ();
if (pDlg->IsKindOf(RUNTIME_CLASS(CDialog)))
else
Another way to do the difference is the first member of both possibilites. By MessageBox the first member is a handler o a window hWnd , and in a DialogBox this handler is of the application instance hInstance
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Thanks for ur reply.
I am trying to write a message box hook.
In that i need to differentiate the message box from other windows and dialogs.
I tried your suggestion but i could not achieve that .
I appreciate your help.
|
|
|
|
|
kuttiam wrote: Can any one tell me how to differentiate messagebox dialog from other dialogs.
MessageBox is type of dialog. but you don't need template to create it as it required by Dialog. plus a single api call i.e. MessageBox will create the message box for you!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I made this function of getting a unicode MAPI property:
LPMESSAGE msg = NULL;
wstring subj;
HRESULT hrProperty;
LPSPropValue lpPropValue = NULL;
hrProperty = HrGetOneProp(m_Message->Interface(), PR_SUBJECT_W, &lpPropValue);
if (hrProperty == S_OK)
{
subj = static_cast<wstring>(lpPropValue[0].Value.lpszW);
}
return _bstr_t(subj.c_str());
now I need the subj value for SetSubject(Subj.c_str(),codePage) from altmime however when I pass the value of subj to a string it loses it's contents(I am retrieving asian characters) it turns into ??? from the original value.
Help please,
Jj
|
|
|
|
|
monsieur_jj wrote: when I pass the value of subj to a string it loses it's contents(I am retrieving asian characters) it turns into ??? from the original value.
offcourse it will lose every thing as string can have 256 value per character and wide string have 2 power <superscript>16 values per character. so if you are using asian character set ..then work with wide string only
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
In this MFC dialog base project, I used command line arguments. I want to make my application like, when user give /silent argument from command line, only console window should be display else
normal dialog box. I used AllocConsole function in OnInitDialog function. Using that it displays both the windows viz cosole and dialog.
I used the following lines :
if (!AllocConsole())
AfxMessageBox("Failed to create the console!", MB_ICONEXCLAMATION);
please help me ...?
Regards,
Mayuresh
|
|
|
|
|
Does ShowWindow (FALSE) help when used in your dialog?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
No, ShowWindow(SW_HIDE) does not work
|
|
|
|
|
It should... but ok.
Then... what about getting the DesktopRect and moving the dialog with MoveWindow (...) or with SetWindowPos(...) outside the visible area?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek wrote: It should... but ok.
he is right, SW_HIDE will not work for Dialog bix, reason behind it is that when OnIntDialog complete it call it show the Dialog Box. so you have write some other mechanism to do so.. see here http://www.codeproject.com/dialog/dlgboxtricks.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
You have access to the command line arguments at startup.
If you determine you don't want a GUI window to show then you shouldn't
show the window.
Create your main window without the WS_VISIBLE style. If you want the main
window to show, use ShowWindow(SW_SHOW).
If your main window is a modal dialog, don't call DoModal().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: If your main window is a modal dialog, don't call DoModal().
he seems to programming in OnInitDialog instead of OnInitInstance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hai..,
i am trying to create an MSMQ. in this i am having char* string value....now i want to convert it to LPWSTR string ...how to convert this...
is any one knows reply me....
Born to win...!
|
|
|
|
|