|
I do not know a way to get all exceptions.
try
{
}
catch(CException *e){}
is not working for all exceptions. If I put catch(...) it is ok but I cannot get the error message this way.
Do you know what I can put in the catch () so that I can handle all exceptions having their messages.
Thank you!
modified 8-Mar-17 3:46am.
|
|
|
|
|
In order to catch everything, you need to look at the docs for the function which is throwing the exception and then add a catch statement specific for that.
try<br />
{<br />
}<br />
catch(CException *e)<br />
{<br />
}<br />
catch(LPTSTR szErr)<br />
{<br />
}<br />
catch(...)<br />
{<br />
}
Waldermort
|
|
|
|
|
Have u tried using
"try-finally-statements"
-Sachin
|
|
|
|
|
Exactly how does that get the text of the exception being thrown?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Im not sure but I think some times ago I saw a code on the http://www.koders.com about get exceptions see this site.
|
|
|
|
|
I'm trying to enable the SE_TCB_NAME privilage within the token of my process, but for some reason after the call to AdjustTokenPrivilages() GetLastError returns ERROR_NOT_ALL_ASSIGNED. My program is running in elevated mode so I can't understand why I am unable to set this.
Is there something I am missing?
Waldermort
|
|
|
|
|
The AdjustTokenPrivileges function cannot add new privileges to the access token. It can only enable or disable the token's existing privileges. To determine the token's privileges, call the GetTokenInformation function.
-Sachin
|
|
|
|
|
in some of the source codes, i came across defining a function like this.
int function(int a,...);
can any body explain me the significance and use of the above convention?
thanks.
-- modified at 3:39 Wednesday 3rd October, 2007
|
|
|
|
|
See here[^]. Basically it's used to define a function which takes a variable amount of arguments.
Steve
|
|
|
|
|
thank you stephen,
but can you narrate an example, where this sort of convention can be used.
|
|
|
|
|
There's sample code at the bottom of the link. printf and sprintf use this construct: both functions take a variable number of arguments.
Steve
|
|
|
|
|
so nice of you for the example.
i will try to implement it in my applications and post back if any more doubts are there.
thank you.
|
|
|
|
|
Microsoft has forgotten to include the standard va_copy() function/macro. See http://www.codeproject.com/script/comments/forums.asp?forumid=1647&mpp=50&select=2255221&df=100&fr=51[^]
va_copy() is required in a function like vprintf (which is probably how printf is actually implemented on most systems:
int printf( const char* format, ... )
{
int ret;
va_list args;
va_start( args, format );
ret = vprintf( format, args );
va_end( args );
return ret;
}
)
but unlike vprintf, you need to traverse the va_list more than once. There is no portable way to restart the argument traversal process without the va_copy() macro.
In my program, I went ahead and wrote:
#include <stdarg.h>
#ifndef va_copy
# define va_copy(dest,src) ((dest)=(src))
#endif
This may be confusing to a newbie to the subject, but if you program long enough, and you try to factor your code correctly, you're going to run into this situation.
David
|
|
|
|
|
Hi,
How long is the maximum popup time that can be set to a tooltip?
Thanks in advance.
- NS -
|
|
|
|
|
NS17 wrote: maximum popup time
I think that there isn't any limit
Russell
|
|
|
|
|
From my experiments I understood that it cant be set more than 0x7fff (signed short int max)
- NS -
|
|
|
|
|
|
TTM_SETDELAYTIME with TTDT_AUTOPOP flag
- NS -
|
|
|
|
|
Oh yes, got it.
Exactly, I found 7FFF milliseconds too.
If you need more I think that you need a custom tolltip that use a timer.
Russell
|
|
|
|
|
Less the code, lesser the bugs...
- NS -
|
|
|
|
|
|
You send the ToolTip control a TTM_SETDELAYTIME message with a WPARAM argument of TTDT_AUTOPOP and an LPARAM argument of the number of milliseconds
|
|
|
|
|
I have a button with text and an icon drawn on it.
If the user changes some entry, I want to be able
to change the text and the icon. I can do this, however,
everything just jumbles on top of the button. How can
I erase the background of the button so that when I
put the new text and icon, it looks clean?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
DanYELL wrote: How can
I erase the background of the button so that when I
put the new text and icon, it looks clean?
How are you changing the icon and the text?
How are the icon and text drawn?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It looks like this:
<br />
void ColorYes(CXPStyleButtonST *m_button)<br />
{<br />
CFont *SimpleFont = new CFont;<br />
SimpleFont->CreatePointFont(90, "Arial");<br />
<br />
m_button->SetFont(SimpleFont);<br />
<br />
m_button->SetBitmaps(IDB_GREEN_CHECK, WHITE, IDB_GREEN_CHECK, WHITE);<br />
m_button->SetFlat(FALSE);<br />
m_button->SetColor(CButtonST::BTNST_COLOR_FG_IN, WHITE);<br />
m_button->DrawTransparent();<br />
<br />
m_button->SetWindowText("Yes");<br />
}<br />
<br />
void ColorNo(CXPStyleButtonST *m_button)<br />
{<br />
CFont *SimpleFont = new CFont;<br />
SimpleFont->CreatePointFont(90, "Arial");<br />
<br />
m_button->SetFont(SimpleFont);<br />
m_button->SetBitmaps(IDB_RED_NO, WHITE, IDB_RED_NO, WHITE);<br />
m_button->SetFlat(FALSE);<br />
m_button->SetColor(CButtonST::BTNST_COLOR_FG_IN, WHITE);<br />
m_button->DrawTransparent();<br />
<br />
m_button->SetWindowText("No");<br />
<br />
}<br />
I call ColorYes and it puts the bitmap and text on the button. I call
ColorNo and it puts the new bitmap and text on top of the button with
the old image and button.
I need to call something that clears the button before I add new
stuff. I just dont know what function to call.
??
|
|
|
|