|
I'm sure it does'nt write past iLen * 7 but I'm not sure whether it can corrupt the stack. Please tell me how code can corrupt the stack? (Becuase I really dont know if the question seem stupid)
Polite Programmer
More Object Oriented then C#
|
|
|
|
|
Hello.
IMO, The usual reason for stack corruption is this:
foo
{
char text[5];
strcpy(text, "Hello");
}
text is a stack variable of 5 chars, but the strcpy() copies 6 bytes to it.
The last character written (the '\0' byte) will be written outside the boundry of text.
******** THIS IS A SIMPLIFIED EXPLANATION ********
The return address (to the function that called foo()) is also saved on the stack.
When the function foo returns, the return address is picked up from the stack. But a part of the return address is now overwritten by the the '\0' byte, and is altered.
So the program retuns to the wrong address, causing the program to go bananas.
That's stack corruption.
-- modified at 3:06 Wednesday 27th September, 2006
But you can get a lot of different fishy behaviour from stack corruption. It depends how the compiler uses the stack. It doesn't have to result in wrong return address, other things can happen, such as another stack variable suddenly changes its value, e.t.c.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi,
I used property sheet method to create two property pages: PageA and PageB.
I edited some values in PageA,but did not click save button, then I went to PageB.What should I do to see my previous value in PageA when I came back from PageB?
Thank you in advance,
yijia
-- modified at 2:16 Wednesday 27th September, 2006
|
|
|
|
|
yijia_24 wrote: What should I do to see my previous value in PageA when I came back from PageB?
Nothing special. Values are retained by default. What does the OnSetActive() method look like for PageA?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you very much. I solved that problem.
I appreciate you spending time over my question.
|
|
|
|
|
yijia_24 wrote: I solved that problem.
Do you mind sharing your solution with others?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
so sorry about that. I think my method doesnt work... I do not have onSetActive() in my program. Would you tell me more detail about onSetActive()?
Thank you very much!
|
|
|
|
|
yijia_24 wrote: Would you tell me more detail about onSetActive()?
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I have a MS Chart Control. I process data dynamically and put 10 Frames of data on it every second. For which the timer value should be 100 MilliSeconds. The problem is that since timer value is low the flickerring rate is high and visible. I cannot increase the timer.
Is there any other way to bring down the flickering effect.
Thanks in Advance.
Regards
Kenny.
|
|
|
|
|
Did you try double buffering? There are heaps of samples, at CP and elsewhere.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
hi ,
i have a project in borlands c++ to be converted to vc++.
The package concept in borlands c++ uses vcl(visual component library)
how to use this default library of borlands c++ in vc++???
if used is it possible to use the package concept in vc++.
reply immediately,
thanks in advance,
zari
|
|
|
|
|
zareee wrote: reply immediately,
But of course, what else would I be doing ?
zareee wrote: how to use this default library of borlands c++ in vc++???
I doubt you can.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hav u ever used this??
i am struck up with how to use VCL in vc++
can u please help me out in this
zari
|
|
|
|
|
I'm always interested when I answer people and they ask the same question again.
Why would Microsoft support Borland's libraries ? If it can be done, it would involve a lot of hacking. If you have the full source for the VCL, you may be able to use it as a library in your code, but again, I doubt it.
I've googled ( I assume you have too ? ) and I can't see anything. I think your chances are low.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanx, i need to know is it possible to create a ocx in borlands c++?
zari
|
|
|
|
|
Christian Graus wrote: zareee wrote:
reply immediately,
But of course, what else would I be doing ?
He said immediately, Christian, not nine minutes later. Look, if you can't get these questions answered in a timely manner, you're going to have to forfeit your beanie.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello
I am trying to keep a window within a certain bounding rect. So far I am capturing the WM_ENTERSIZEMOVE message within the window procedure and doing this:
boundry is the program defined rect that the user should stay within.
pt is the mouse POINT.
rect is the window RECt.
<br />
test.left = boundry.left + ( pt.x - rect.left );<br />
test.right = boundry.right - ( rect.right - pt.x );<br />
<br />
test.top = boundry.top + ( pt.y - rect.top );<br />
test.bottom = boundry.bottom - ( rect.bottom - pt.y );<br />
<br />
ClipCursor( &test );
There are a few problems that arise, one of them is that depending on where i grab the window, the resulting boundry rect is sometimes off by as much as a few pixels.
Whats the dilly?
|
|
|
|
|
You're doing it the hard way. Just trap the WM_MINMAXINFO message
|
|
|
|
|
Thanks,
does this work for moving and resizing?
|
|
|
|
|
Are there any systemic issues around power management? sleep?
I am using a 3rd party library, and it seems that following wake, I can get their library to crash.
They are unsure what the problem might be, so to help, I thought I'd do some research?
What kinds of issues crop up?
Are there issues with some system services on wake?
COM issues?
Thanks
-peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Hi!
I've got a SDI-Application and want to implement a counter which displays for how long my application is running since I compiled it.
I use timeGetTime() but it seems as if timeGetTime() is very imprecisely. Afer 60 seconds my counter counted to 62 seconds.
Here's a part of my program:
<br />
if ((::GetTickCount() - dwTime) > 1000)<br />
{<br />
dwTime = ::GetTickCount();<br />
<br />
if (view->GetSeconds() < 59)<br />
view->SetSeconds(view->GetSeconds() + 1);<br />
else if (view->GetSeconds() >= 59)<br />
{<br />
.<br />
.<br />
.<br />
}<br />
strTime.Format(_T("%02d:%02d:%02d"), view->GetHours(), <br />
view->GetMinutes(), view->GetSeconds());<br />
view->m_Timer.SetWindowTextW(strTime); <br />
<br />
}<br />
I would really appreciate if someone could help me.
Please excuse my bad English
enne
|
|
|
|
|
why dont u just use the WM_TIMER message with 1000ms interval?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Why dont u just use WM_TIMER msg with 1000ms interval?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
enne87 wrote: which displays for how long my application is running since I compiled it.
A - how long it's been since you compiled it + how long it's been running ?
or
B - only how long it's been running ?
It's confusing.
for A, you can get the time the executable file was created + the time the application is running (B).
for B, when the application starts, keep the current time ( with time ) and at each WM_TIMER trigger, get the current time, and compare with the one you kept earlier; do some simple time math and set the text to the window
|
|
|
|
|
I see, thanks for the great help guys
|
|
|
|