|
I suspect you're suffering from a change in the syntax between VC6 and Visual Studio 2003 C++ combined with a stray semi colon. The scope of counters in for loops (i in your case ) has changed so that if they're declared in the loop they can't escape from the loop. You possibly have 2 i's happening here in different scopes which is to say the least. I now use this syntax to try and be both 'correct' and compatible
<br />
int i = 0;<br />
for( ; i < m_NumberOfObjects; i++ )
{<br />
m_ListObjects[i]->DoStuff();<br />
}<br />
<br />
for( int i; i < m_NumberOfObjects; i++ )
{<br />
m_ListObjects[i]->DoStuff();<br />
}<br />
The extra ; has caused the intended loop code to happen only once and declaring the i outside has let you get away with it Perhaps that's why they changed it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks all for your replies, obviously just the stray semi-colon (couldn't spot it after looking at the code for ages, post the question on here and spot it straightaway always the same!)
Andy,
|
|
|
|
|
I know the feeling.
Therefor I sometimes use one of my colleagues to wine about some extreme strange bug.
They are willing to help. Once I show them the piece of code and start explaining what it suppose to do. I start swearing at my own stupidity. Time on time i have found the bug before they do.
codito ergo sum
|
|
|
|
|
mcsherry wrote:
int i = 0 ;
for ( i = 0 ; i < m_NumberOfObjects ; i++ ) ;
{
m_ListObjects[i]->DoStuff ( ) ;
}
there you are. The semi colon in the second line is causing problems to you.
sorry, i didn't see that you figured it out by yourself.
Regards,
Vijay.
God may not give us what we 'want', but he surely gives us what we 'need'.
|
|
|
|
|
The compiler should have given you a warning about that semicolon. If not, turn warnings back on.
|
|
|
|
|
I don't think so Mike. That looks like completely valid C code with the semi-colon in there.
That one would drive me nuts if I didn't see it right away in my code LOL
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All
i want to detect at run time what kind of device is connected to USB port(like if Digital camera is connected then it shows Digital camera etc.)like how our windows is showing(if you cannect scanner to USB port then in My computer you can view in "Type" Image scanner.
i got something "SystemParametersInfo" but i dont know how will i use it and wheter it is useful or not
Thanks in advance
R e h a n
|
|
|
|
|
Basically the symbolic link for the device should have the GUID which should be unique per type .
Look into plug and play notifications on Windows
Engineering is the effort !
|
|
|
|
|
I want to change the color of static control to white.As well as in the static controls the text also should be visible.
CStatic temp = new CStatic();
temp->Create(text ,style |SS_LEFT ,pos ,this ,m_iAutoControlID);
bhw
|
|
|
|
|
See WM_CTLCOLORSTATIC and on the this message use of SetTextColor() for text color and SetBKColor() for background color.
|
|
|
|
|
This is a dynamically created control.is there any style or method to do that.
bhw
|
|
|
|
|
I dont understand what you said can you more explain.
|
|
|
|
|
WhiteSky wrote: I dont understand what you said can you more explain.
The control is created at runtime rather than design time.
"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
|
|
|
|
|
No I want to know his question was about control or color.
|
|
|
|
|
Hello
Use WinProc or PreTranslateMessage to catch the message WM_CTLCOLORSTATIC
and compare the control id with the id that you give to your static.
And then is just the same as if you use the designer.
Something like this:
BOOL CYourDialog::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(pMsg->message == WM_KEYDOWN && pMsg->wParam==VK_RETURN)<br />
{<br />
if(IsWindow(m_YourStatic.m_hWnd))<br />
{<br />
if(pMsg->hwnd==m_YourStatic.m_hWnd)<br />
{<br />
DoSomething();<br />
}<br />
}<br />
}<br />
}
|
|
|
|
|
I am new to window programming and I need to do a task which is to know whether all the child dialogs have been exited before closing the main dialog. Can you please direct me, how can i do it?
Further explanation is the main dialog should not exit of ESC key unless all the child dialogs are properly closed.
Thanks in advance.
S.S
-- modified at 8:53 Tuesday 12th June, 2007
|
|
|
|
|
Are the child dialogs modal or modeless?
"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
|
|
|
|
|
DavidCrow wrote: Are the child dialogs modal
I hope not
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote:
I hope not
Why?
"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
|
|
|
|
|
|
While it's true that you couldn't have:
parent
/ | \
child child child You could easily have:
parent
|
child
|
child
|
child I read his question as "all child windows," regardless of the immediate parent window.
"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
|
|
|
|
|
Right. I read it the other way.
Which is why I said I hope not. I never claimed to make sense
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Hi,
take a look in the posts of this link[^]
I have implemented an override of CanCloseFrame checking out if the view/window to be closed id the main or not. And closing all the child windows/secondary views if the Close comes from the main view / parent window.
I think you can easily modify my code to adapt it to your conditions.
If you don't understand how it works take a look to the posts I wrote (Search autor: nelek, keywords: Child Window) to see where and why I am using it.
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?
|
|
|
|
|
I use get_selection to get the source code selected by mouse,and then I try to match it in whole html text source code,and now I hope to let the matched html block to be translated into corresponding IHTMLELEMENT,how can I do next step?
For example,there is the following code:
help
I selected "" and want to use red line to surround the table,who can give me some advices?thks.
|
|
|
|