|
Joe Smith IX wrote: I know I can simply use one of the CStatic-derived classes here, but that means I have to declare/initialize/set each member of the CStatic for all my dialogs! This means hundreds!
Just how hard is it to use the search/replace feature of the IDE?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It's not hard at all to use search/replace. The problem I was referring to was that I would have to declare EACH and EVERY 'Static Text' as object, then initialize and set the properties of each one of them! Am I correct, or there is a much simpler way?
|
|
|
|
|
Joe Smith IX wrote: Am I correct...
No.
Joe Smith IX wrote: ...there is a much simpler way?
Yes.
Once you have a class derived from CStatic , simply change your dialog's .h file by renaming all references to CStatic to your derived class. In the derived class, see the Extras section of this article.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am trying to set the VC++ 6.0 Editor so that the EOL is set to UNIX style and NOT windows style.
Please help.
Baidehish Dwibedy
tdwibedy@yahoo.com
|
|
|
|
|
Baidehish Dwibedy wrote: I am trying to set the VC++ 6.0 Editor so that the EOL is set to UNIX style and NOT windows style.
what do you mean ?
where should the EOL be unix style ? in the program ? or in the code editor ?
|
|
|
|
|
How do we handle exceptions in C++/VC++ ?
try catch, __try __except, CExecption etc right? I'd like to discuss on this, anybody up there? good in these?
Ok, as a start up, I'd ask you a simple question,
I divide an integer by 0 UNKNOWINGLY that we are not going to make a manual *throw* anywhere. It should be handled. how do we do that?
__try
{
int i=10;
i=i/0;
}
__except(char* ex)
{
//But the hell now comes here
}
something like that? And why someone would go for structured exceptions? Should we design our own exceptions on our own? Why not it's like the way it is in C#
286? WOWW!
|
|
|
|
|
Probably better to check the value you're dividing by in this situation, but if you must use exceptions you could do something like:
int i = 10;
try
{
i = i / 0;
}
catch( ... )
{
// do whatever you need to do to handle the situation
i = 0;
}
// use i
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks steve, but it's not entering the catch block, rather, the debugger makes a break at the line and pops up an "Unhadled Exception, divide by 0 error".
286? WOWW!
|
|
|
|
|
that's because such a mathematic fault doesn't throw an exception.
some function however do handle the "division by 0" case and send a related exception; native operators don't have such an implementation, and you should test yourself that you're not dividing by 0 before actually do the operation...
|
|
|
|
|
void main()
{
int i=3;
__try
{
i=i/0;
}
__except(GetExceptionInformation())
{
printf("Gotcha!");
}
_getch();
}
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
. Thanks.
286? WOWW!
|
|
|
|
|
That is strange code. It's normally done like this:
int main()
{
int i=3;
__try
{
i=i/0;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
printf("Gotcha!");
}
_getch();
return 0;
}
Or even better:
bool IsDivideByZero(DWORD code)
{
return code==EXCEPTION_FLT_DIVIDE_BY_ZERO || code==EXCEPTION_INT_DIVIDE_BY_ZERO;
}
int main()
{
int i=3;
__try
{
i=i/0;
}
__except( IsDivideByZero(GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH )
{
printf("Gotcha!");
}
_getch();
return 0;
}
Steve
|
|
|
|
|
This is quite clear! Thanks Stephen
286? WOWW!
|
|
|
|
|
In standard C++ catch(...) will not catch hardware exception by design: divide by zero should not be caught by your code on standard compliant compilers. MSVC6 was non standard in this area (and many, many others). Later MS compilers fixed this bug but provides the /EHs[^] switch to use the old buggy exception handling semantics. In short, using catch (...) like this is a worry (I'm of the opinion that you should almost never use it anyway).
Steve
|
|
|
|
|
How can I write something somilar to a MDI application (using Visual Studio) where:
*Document is write in C++ to have fast routines
*View/ frames/ menu /other grafic tools are writed with a different lenguage (as C# or VB NET) to use in a more easy and fast way objects like image editing tools/data tables/... (and ... to split this job with other people)
Can .NET help me?
any articles that shows detailed procedures?
any lectures?
thanks
Cheers,
Russell
|
|
|
|
|
Hi!
In runtime suppose I want to identify the handle of one main window and the child controls window like combo,listview and button which is inside the main window. How can I check whether it is main window handle and it is control window handle?
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Have a look at IsChild function.
|
|
|
|
|
In VC++ when we assigning the port number to the socket programming ,how to check wheather the port number was already exiting or not
shakumar
|
|
|
|
|
I would think the connection would return something like WSAEADDRINUSE .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi there,
I'm wondering on how to expand the dialog box vertically automatically as the item display in a cwnd custom control is bigger than the original size. Are there any good ideas?
TQ.
|
|
|
|
|
Explore dilaog[^] section on CP, check if you get any help there. I remembered reading some article of resizable dialog.
|
|
|
|
|
Your question is a bit unclear. Are you saying that a control on the dialog is larger than the dialog itself?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
when some drawing displayed in the custom control become vertically larger than the original size of the custom control(this happen maybe through zooming in), what should i do in order to enlarge the dialog and the custom control in the dialog box in order to be able to view the drawings without scrolling?
|
|
|
|
|
cyn8 wrote: control is bigger than the original size
How do you create them?
|
|
|
|
|
i add a custom control in the dialog using resource editor and registering it. It is CWnd generic based class.
|
|
|
|