|
toxcct wrote: does this set all the array cells to 0...
Yes, that's what the REP STOSD instruction is for.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
STOre String Doubleword.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
toxcct wrote: does this set all the array cells to 0, or only the 1st one ? I have a doubt
"If a class has a constructor, arrays of that class are initialized by a constructor. If there are
fewer items in the initializer list than elements in the array, the default constructor is used
for the remaining elements. If no default constructor is defined for the class, the initializer
list must be complete — that is, there must be one initializer for each element in the array."
But why doesn't this use the "default constructor" ...
unsigned short test;
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
yes, but we have no class here, only native type
|
|
|
|
|
Right - check my post again (I just appended it )
I see the behavior but I'd like to see it documented. Anyone know where I can find that?
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
toxcct wrote: does this set all the array cells to 0, or only the 1st one ? I have a doubt
It does set all array cells with 0, in this case. Actually, this is standard way to initialize array.
|
|
|
|
|
It sets the first element to 0 (because that's the value inside the braces). Then, since you're out of initializers, the remaining elements are automatically set to 0.
|
|
|
|
|
Hello!
Iam beginner of vc++, and trying small project in vc++ using MFC.
Plz can any one give me the guide lines for the project
Counting the number of pages the printer was printing .
This is my first message ,so if any mistake in the message
Plz avoid that.
Regards,
shakumar
shakumar
|
|
|
|
|
int i;
for (i = 0; I < nNbPagesToPrint; i++) {
std::cout << "Printing page " << (i+1) << std::endl;
PrintPage();
}
std::cout << "Nb Pages printed : " << i << std::endl;
|
|
|
|
|
You quanify cout with std but you don't for endl . I assume this is an oversight.
Steve
|
|
|
|
|
you're right, i fixed this...
anyway, i was joking, so it doesn't really matter, because i doubt one will compile this
|
|
|
|
|
shanthakumar_21 wrote: Plz can any one give me the guide lines for the project
Counting the number of pages the printer was printing .
Not exactly a project for a beginner, but you'll need to become familar with the Printing and Print Spooler API.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi everybody,
in my project i have a complicated/strange structure of architecture :
MDI Project -> Frame(1) -> View(2) -> TabWnd(3) -> View(4) -> TabWnd(5) -> View(6)
1) The Frame with all customers
2) A View which contains the TabWnd
3) Each Tab of the TabWnd corresponds to a Customer
4) The View which displayes the informations and a Tab
5) The Tab with several opened "orders from this customer"
6) The detail of the order
If i press the ESCAPE Key in the Order-View(6) i send a Message to the MainTab(3) which
should close the entire Tab (should close 4+5+6)
The "RemoveTab" Function performs a ->DestroyWindow() of the View in this Tab (4)
Now the question : Why does it calls the destructores in the different way?
At first Destructor of the View(6), than the destructor of the View(4) which performs a "delete Tab;" and follows the destructor of the Tab(5)
Is it possible that the View(6) destroyes automaticly all Views from which he is the owner?
Big thanks
|
|
|
|
|
A parent Window, when closed, automatically closes all of its child windows. Your structure as you describe it appears to be something like this:
Frame(1)
|
+- View(2)
|
+- TabWnd(3)
|
+- View(4)
|
+- TabWnd(5)
|
+- View(6) If the window and/or object destructions are happening out of order, it's possible you've got a parent/child connection (either in the windows or in the objects) that's not correct.
Software Zen: delete this;
|
|
|
|
|
I'm using Visual C++ 6.0 on Windows XP. I need to make a dialog box that graphs data being read in on the fly. The data is read in from a USB device. I need to be able to graph each point on a dialog box in a self made graph. So what I do first is draw a rectangle with the default white background. And then with relation to the pixels on teh screen I draw Lines to the appropriate point depending on the next value read in. I use the MoveToEx () function and the LineTo() function. I need to draw a new Line to a new point every second. I have a timer that triggers a WM_TIMER message every one second. When this is triggered I use SendMessage() to the dialog with the graph. I send a WM_PAINT message. In that the window is repainted and I draw a new Line. Problem is the previous lines get erased. How do I take a picture of the previous screen? If i can do that then I should be able to repaint that first and then draw the new line, right? Has any one else done there own graphing program before? I was thinking of using Matlab to do the graphing, but I don't have MatLab, and the program needs to be distributed to a lot of people so I'm guessing all of them will need Matlab right?
Thanks for your help.
-- modified at 10:04 Thursday 15th February, 2007
------------------------
Impossible is Nothing
|
|
|
|
|
I made a charting control some time ago and I wrote a CP article about it. If you are interested, you can have a look here[^], I think it does what you are looking for.
|
|
|
|
|
the article looks cool, I'll take a look, Thanks!
------------------------
Impossible is Nothing
|
|
|
|
|
There's no need to only paint in response to a WM_PAINT.
Try breaking your drawing code into a separate method and call it from both the OnPaint()
and from OnTimer().
void MyDlgClass::DrawGraph(CDC &dc)
{
... draw graph to DC ...
}
void MyDlgClass::OnPaint()
{
CPaintDC dc(this);
DrawGraph(dc);
}
void MyDlgClass::OnTimer(UINT_PTR nIDEvent)
{
CWindowDC dc(this);
DrawGraph(dc);
}
Also you shouldn't send WM_PAINT messages yourself. Use Invalidate() and UpdateWindow()
for an instant WM_PAINT message instead
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Ok, I'm drawing the graph in a seperate method like you said. It works! BUT it only works if WM_PAINT is not called. So lets say I have two dialog boxes open. which will most likely occur. If I have the graph dialog box open and then the user selects the other dialog box and moves it over the graph the part of the graph it moved over will be erased. How do I repaint that? I need to somehow get a picture of that area and repaint it.
------------------------
Impossible is Nothing
|
|
|
|
|
deville75 wrote: How do I repaint that? I need to somehow get a picture of that area and repaint it.
You need to repaint it. Draw the rect, fill with white, draw the graph.
See my second reply
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Also, for redrawing the lines you can store the points in an array and iterate through them
each time they need to be redrawn. Taking a snapshot of the screen doesn't work - what if the
user drags another window across yours? That's why you need to redraw everything every time
(of course you can use clipping to only redraw the portion of the window that needs to be
refreshed as well).
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
I c.. ok, I'll try keeping an array of the points.. But what is clipping? I'm guessing it checks which part of the window WM_PAINT needs to repaint? How would I be able to retrieve these coordinates?
------------------------
Impossible is Nothing
|
|
|
|
|
I wouldn't worry about clipping yet In your WM_PAINT handler, clipping is setup for you
so I would recommend just getting all your repainting working properly. Then if you have problems
with flicker or something then worry about clipping.
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
hehe, i c, ok kool,
thanks for the help guys.
------------------------
Impossible is Nothing
|
|
|
|