|
You may need to have your CFrameWnd -derived class handle the WM_GETMINMAXINFO [^] notification. Windows calls it when adjusting the size of a window.
|
|
|
|
|
Hello!
I have created a custom edit control that uses COleDropTarget to accept/insert text drops. This works very fine.
However, when putting the edit control into a group control in the resource editor of Visual C++, the group control prevents the edit control from getting drag&drop notifications.
Is there any way to make the group control "forward" the drag&drop notifications? Or any other way such that the edit control sees the drop?
Best regards
Dominik
|
|
|
|
|
Hi all,
In an if statemen if ((Comp1) && (Comp2)) is Comp1 evaluated first and Comp2 after?
I mean, if Comp1 changes a variable, will this variable be changed by the time Comp2 is evaluated? Hence, can I use a variable assigned in the first comparisson to perform the second? Or would I have to do two if's in a row?
if(Comp1)
if(Comp2)
Thank you!
|
|
|
|
|
Yes, Comp1 is evaluated first. And also, if Comp1 is false, then Comp2 won't be evaluated. So you the variable will be modified once you check the second comparison.
|
|
|
|
|
yes, comp1 is avaluated before comp2.
also, you have to know that depending on the comparison operator used, the other "comps" may not be evaluated.
check this :
if ((1==1) || (c == d)) ...
here, the test (c == d) is never performed, because (1 == 1) is true, so true OR anything is actually true.
same is this :
if ((0==1) && (c == d)) ...
same is (0 == 1) always returns false, so false AND anything is false...
so if that even happens, when you have a function call of a variable modification in such a construction, it may not be performed...
basically, a if/while conditional statement should be used only for testing a condition to avoid mistakes.
|
|
|
|
|
piul wrote: In an if statemen if ((Comp1) && (Comp2)) is Comp1 evaluated first and Comp2 after?
It's called short-circuit evaluation.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Also, if you're not entirely clear on operator precedence and
ssociativity in C++, then maybe keep a link to this handy:
Operator Precedence and Associativity[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
void main
{
float a = 5.0 , b = 0.1 ;
float c ;
c = a + b ;
if( c >= 5.1 )
{
printf( "OK" ) ;
}
else
{
printf( "Not OK" ) ;
}
//in the above code c does not contain the the result i expected , it filled with 5.099999 and i get the output Not OK.
how i can check the value of c ? please help me
Thanks & Regards
|
|
|
|
|
That's because of floating point precision. Your float will never be represented exactly. Check this[^]
|
|
|
|
|
nitin3 wrote: //in the above code c does not contain the the result i expected , it filled with 5.099999 and i get the output Not OK.
how i can check the value of c ? please help me
Try this... works for me...
void main()
{
float a = 5.0f , b = 0.1f ;
float c = a + b;
if( c >= 5.1f )
{
printf( "OK" ) ;
}
else
{
printf( "Not OK" ) ;
}
}
Always append "f" to a float value else it's treated as a double, earlier you were comparing a float var and a double var.
Explained further -> http://nibuthomas.wordpress.com/2007/06/08/comparing-two-float-values/[^]
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
floating point numbers are limited in resolution. They can get very close to the result, but not necessarily exact. You can minimize the problem by using "double" instead of "float", but that doesn't eliminate things. One quick fix is to simply use a small delta value in your computations. For example:
float delta = 0.000000001;
where delta is some number much smaller than you care about in your program. Then for greater than comparisons include it
if (c >= (5.1 + delta)) printf("OK");
|
|
|
|
|
Kwanalouie wrote: float delta = 0.000000001;
Correctly defined as epsilon.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Another approach: Use rational numbers. Use ints for the numerator and denominator. It requires a bit more coding, but your fractional numbers will be exact.
|
|
|
|
|
To create status bar on a dialog which class can be used CStatusBar or CStatusBarCtrl.
I am bit confused
|
|
|
|
|
|
|
Why don't you write a reset member function that does that ?
|
|
|
|
|
See also the Memento design pattern [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi,
How can I send a email message through coding?
|
|
|
|
|
Did U google this ????
you can find it from
<a href="http://www.codeproject.com/KB/aspnet/EmailApplication.aspx">http:
and this also...
[^]
or if u r looking for code only
MailMessage message = new MailMessage();
message.From = new MailAddress("sender@foo.bar.com");
message.To.Add(new MailAddress("recipient1@foo.bar.com"));
message.To.Add(new MailAddress("recipient2@foo.bar.com"));
message.To.Add(new MailAddress("recipient3@foo.bar.com"));
message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
but before asking for help u should google ...
vikas da
|
|
|
|
|
iz ur scrn so sml tht u hve 2 uz txtspk?
|
|
|
|
|
tasumisra wrote: Did U google this ????
you can find it from
But your google was set to ASP.NET but he or she wants for c++?
|
|
|
|
|
I guess he is/was looking for a logic not implimentation
and nobody gonna give him the whole code ...
are you ?????
vikas da
|
|
|
|
|
Did you see other answers?
|
|
|
|
|
Never heard about CP articles search engine [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|