|
hmm.. May be complicated..
|
|
|
|
|
My application is a MFC Win32 Dialog developed in VS6.0.
The dialog is used mainly for user input to parameters for a lengthy process called from a function within the dialog. I am using the windows UpdateWindow() method and Invalidate() from within the function to update the dialog indicating the number of records that have been processed and saved to a file. This seems to work correctly when ran on a Windows 2000 PC. but when I run it on a Window-XP PC the dialog is blanked with only the frame remaining whenever the application's focus is lost, by clicking on a desktop icon or launching an other application. Is there a solution to this problem? Could some sample code be provided to do this task?
Thank you.
Sample of my code follows:
<br />
while(!feof(In_File) )
{<br />
if(fgets(Sbuf,3000,In_File) != NULL)<br />
{<br />
rin++;<br />
DRec Srec(Sbuf, ',' , ',');<br />
Pn = Srec.Extract(m_uFieldNorth);<br />
Pe = Srec.Extract(m_uFieldEast);<br />
classNumber = (int)Srec.Extract(m_uClassField);<br />
<br />
Rn = Tn-Pn; Re = Te-Pe;<br />
<br />
RnRe = (Rn*Rn)+(Re*Re);<br />
<br />
if( ( RnRe ) <= Trr )
{<br />
fprintf(Out_File,"%s", Sbuf);
classCount[classNumber] += 1;
}<br />
}<br />
<br />
if((rin % 5000) == 0)
{<br />
SetDlgItemInt(IDC_SDataRecords,rin);<br />
<br />
UpdateWindow();
}<br />
}<br />
<br />
}
<br />
Ralph_L
|
|
|
|
|
UpdateWindow() won't do anything if none of the window is marked for repainting.
Have you tried Invalidate[Rect]() before UpdateWindow() on the window or calling
UpdatwWindow on the control itself?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: ...if none of the window is marked for repainting.
Wouldn't SetDlgItemInt() invalidate the 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
|
|
|
|
|
I would expect it to invalidate the control window (if it didn't draw
the text immediately), not the entire window.
I just tried to offer something to try.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My previous post was a test, and only a test. Had it been an actual post, it would have contained something intelligible.
"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
|
|
|
|
|
If a make a call to CreateProcess() from within my code, is there any way I can break and start debugging the newly created process? Having no sources is no problem, I have become quite good at stepping through assembly.
|
|
|
|
|
in the VS Debug menu, you can use 'Attach To Process' to start a debugging session on the process you just launched.
|
|
|
|
|
I'm guessing the debugger needs an actual file on the disk to work with
I'm getting "Unable to find file" error messages every time I try to attach.
|
|
|
|
|
it needs a running process - and a process needs a .EXE .
what file is it not finding?
|
|
|
|
|
Well, that's the thing, I don't have an .EXE
I'm launching a process from a file stored in the resource section ( NOT a file on disk ), so I'm guessing the debugger is looking for this file so it can display the assembly.
|
|
|
|
|
ah... in that case, you've moved beyond my sphere of knowledge
|
|
|
|
|
Cool, one of the experts "doesn't know" ;P
|
|
|
|
|
WalderMort wrote: Cool, one of the experts "doesn't know"
Experts are also HUMAN
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I've begun using C++ again after mainly using C# for the past several years. I was wondering what is considered the best way to pass a collection of objects to a function assuming the use of the Standard Template Library.
The function that's receiving the collection doesn't care if the collection is a vector or list or whatever, it just wants the objects. Is there a way to pass a collection that decouples the collection type, e.g vector, list, etc., from the function receiving the collection?
|
|
|
|
|
Leslie Sanford wrote: The function that's receiving the collection doesn't care if the collection is a vector or list or whatever, it just wants the objects.
how does that work ?
|
|
|
|
|
Chris Losinger wrote: how does that work ?
Well, that's kind of the question I'm asking. What I'm doing now is this:
void MyClass::SomeFunction(const std::vector<SomeObject *> *collection)
{
std::vector<SomeObject *>::iterator it;
for(it = collection.begin(); it != collection.end(); it++)
{
}
}
The function just wants to iterate over the collection. If I were in C#, I'd pass an IEnumerable object. The function could iterate over it without having to know what the underlying collection is. I'm not sure how to do the same thing in C++ with the Standard Template Library.
|
|
|
|
|
ah. ok.
then, you would pass two iterators, a start and an end, to your function.
template < class _InIt > void DoStuffToIterators(_InIt _First, _InIt _Last)
{
for (; _First != _Last; ++_First)
DoStuff(*_First);
}
...
DoStuffToIterators(collection.begin(), collection.end();
that's a stripped-down version of STL's "for_each" function.
|
|
|
|
|
Oh, I see! Thanks Chris and Michael for helping me out with this.
|
|
|
|
|
You can model your code after the functions in <algorithm> - pass iterators marking the start and end of the sequence.
|
|
|
|
|
Is it possible to prototype a struct to allow a declaration of that struct in the body of the struct.
typedef struct<br />
{<br />
Node child[4];<br />
}Node;
The above code throws an errors as Node has not been declared. Can Node be used inside the struct Node?
Thanks for any help.
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
jimwawar wrote: The above code throws an errors as Node has not been declared. Can Node be used inside the struct Node?
Thanks for any help.
It is a little easier to do with a class than a struct, but you need a struct name rather than a typedef, and you need pointer references.
<br />
typedef struct stNode<br />
{<br />
struct stNode *child[4];<br />
} Node;<br />
The main reason you want pointer references is that every child would have children, which would have children, which would have children, which would have children, etc. A pointer is a fixed size.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
If you could define such a structure you'd need a beefy machine to make use of it; it would require an infinite amount of memory!
Steve
|
|
|
|
|
Hi,
In my darkest of hours, you guys never fail to provide shining light. So here goes...
I'm creating a radio button dialog that goes on top of another dialog, and I'm having a problem with initialization of the whole thing. Specifically, when my radio button dialog is being initialized something is firing off an OnBnClicked event for one of the radio buttons.
1) What could possibly be doing this? It happens in such a way as not to actually leave the button selected. (Yet when you step through you definitely get sent to that event handler.)
2) Is it somehow possible using the magic of VisualStudio to trace what's triggering an event handler?
3) As I mentioned, this radio button dialog window gets pasted on top of another dialog window. Is there something weird about this process?
Thanks - eagerly awaiting any replies - Jason
|
|
|
|
|
So if you set a breakpoint in the event handler and check the call stack, what do you see?
In any case, why is this a problem? Is it causing something to not get drawn?
"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
|
|
|
|