|
Why are you calling Invalidate() there?
What does your WM_MOUSEMOVE handler do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I check if the mouse cursor is on some area, then draw a bound box if it is.
|
|
|
|
|
You should be able to just draw to a client DC without
having to go through the WM_PAINT message.
If you must use Invalidate() there, maybe following it
with an immediate call to UpdateWindow() will help...so
there's no delay before the relulting WM_PAINT message is
processed.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
How do you understand the comments from Bjarne about exception specification?
--------------------
(section 14.6.1 Checking Exception Specifications)
The way to think about exception-specifications is to assume that a function will throw any exception it can. The rules for compile-time checking exception-specifications outlaw easily detected absurdities.
--------------------
thanks in advance,
George
|
|
|
|
|
Compile-time checking means you know every situations, and you rule the world. Such as:
int a = 3;
if(a != 3) {
throw Err();
}
But the spirit of exception is "exception", which means you only know to handle "some" rules, but you won't know "the rest" part. Such as:
try {
bool b = The_API_from_some_DLL();
}
Maxwell Chen
|
|
|
|
|
Thanks Maxwell,
Your reply is clear and my question is almost answered. Bjarne's comment "outlaw easily detected absurdities" means?
regards,
George
|
|
|
|
|
George_George wrote: Bjarne's comment "outlaw easily detected absurdities" means?
Meaning: When you expect the enemy to enter your fort from the front gate (compile-time [easily detected absurdities] ), they might enter from tunnel or from the sky.
Maxwell Chen
|
|
|
|
|
Thanks Maxwell!
Cool!! You always have the same point as Bjarne's.
regards,
George
|
|
|
|
|
Do you want to know about try/catch?
|
|
|
|
|
Thanks Hamid,
I want to know how to understand the following comments from Bjarne about exception specification.
--------------------
(section 14.6.1 Checking Exception Specifications)
The way to think about exception-specifications is to assume that a function will throw any exception it can. The rules for compile-time checking exception-specifications outlaw easily detected absurdities.
--------------------
regards,
George
|
|
|
|
|
I think he wants to tell that you can control exceptions when your program is running.
|
|
|
|
|
Thanks Hamid,
What do you mean "control exceptions"?
regards,
George
|
|
|
|
|
for example you have an runtime error like file not found so if you didnt have any code for it,your program will be producting an error and finish your progra,.
|
|
|
|
|
Hi Hamid,
Does your reply relates to my original question?
regards,
George
|
|
|
|
|
|
Hi Hamid,
I am wondering how do you understand the statements, why "The way to think about exception-specifications is to assume that a function will throw any exception it can"?
--------------------
(section 14.6.1 Checking Exception Specifications)
The way to think about exception-specifications is to assume that a function will throw any exception it can. The rules for compile-time checking exception-specifications outlaw easily detected absurdities.
--------------------
regards,
George
|
|
|
|
|
Hello everyone,
I usually check whether there is bad_alloc thrown to identify whether the allocation is success or not.
My question is,
Is there a way to disable bad_alloc and just to check the returned pointer NULL or not to identify allocation success or not -- which from function point of view, is as correct as the way to catch bad_alloc? Windows platform/Visual Studio is ok. I always see code does not check bad_alloc and just check the return pointer.
(My solution is to select Enable C++ Exception to No in Code Generation option in Visual Studio, not sure whether it is the most correct way.)
thanks in advance,
George
|
|
|
|
|
Did you try like this
int * m_pInt;
m_pInt = new (nothrow) int [10];
|
|
|
|
|
|
I have a float number in a varable (Ex: float m_fNumber;) that is assigned a number(ie, m_fNumber = 12.32;). How can I use SetDlgItem????(ID_FNUM,???); into the editbox?
the following error is received by using CString: ie, : str.Format("%f",m_fNumber);
error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *'
I thought I could format the CString and then use SetDlgItemTextW(...,....) to put it in the editbox.
Does anyone know a solution? HELP
A C++ programming language novice, but striving to learn
|
|
|
|
|
You are doing a unicode build so the Format() function is expecting a wide string as it's formating parameter. Use the _T() macro to change the string to a wide string when building a unicode app.
str.Format(_T("%f"), m_fNumber);
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Yes I did use _T("%f"),f_number); and got that error. I solved it this way:
#if !define ID_FLOAT
#define ID_FLOAT "%F"
#endif
str.Format(_T(ID_FLOAT),f_number);
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
I need to open / read a URL that has PostData. The PostData is long (ASP.Net, so includes the __VIEWSTATE). I just dont know how to send a post back to the server. I am sure its simple, but I have searched and cant find anthing.
An Expert is somone who has previously made ALL the Mistakes, I dream of this day. - Lucky
www.mpic3.com - My PIC based MP3 player project
|
|
|
|
|
The following refers to an application I am writing in VC++ 6.
I want to add some items to a list box in a dialog. I understand that this involves something called DDX, which, as far as I am aware is something that the IDE sorts out for me.
I have added a public variable to the dialog class via the Class Wizard to be associated with the List box - m_listGTTimeUnits.
Now, the application is a Windows Explorer style application and the dialog appears when I right-click over the right hand pane.
I have tried a couple of ways to add values to the list box, both of which allow the code to compile but cause the program to crash with the message "Debug assertion failed" when the dialog is called...
Firstly...
<br />
void CRightView::OnRightmenuEditnode() <br />
{<br />
...<br />
CEditNodeDlg dlg;<br />
dlg.m_listGTTimeUnits.AddString("days");<br />
...
and secondly
<br />
void CRightView::OnRightmenuEditnode() <br />
{<br />
... <br />
CListBox * pList = (CListBox*) dlg.GetDlgItem(IDC_LISTLTTIMEUNITS);<br />
pList->AddString("days");<br />
...<br />
If anyone has any idea of what it is that I am doing wrong, I would be very glad to hear!
Thanks,
Ben.
modified on Saturday, January 26, 2008 10:47:25 AM
|
|
|
|