Hi,
I have 3 pages. I like to set a flag = TRUE when i'm in page3 and set flag = FALSE when i'm in page1 & Page2.
I tried like below,
I set the flag = FALSE in OnInitDialog & OnTimer of Page1 & Page2.
and also set the flag = TRUE in OnInitDialog & OnTimer of Page3.
When i cross Page3 the the flag value changing both true/false when i'm in Page1.
How is possible?
And where and how do you initialize it?
I'm not going to run it until I understand your "logic" there.
I like to use the bool variable "flag" in all pages (page 1, page 2, ... page5).
Its declared as a extern variable and initialize false from wiz.cpp & wiz.h.
wiz.h
Code:
extern bool flag;
wiz.cpp
Code:
bool flag = false;
Now, i like to change the flag value to true from page3 and flase from page1, page2, page4 & page5.
so i used the OnTimer methord to set the flag = true/false from pages.
But Ontimer's of Page3 set to flag = true. but the data was changing both true and false. how is possible?
but the data was changing both true and false. how is possible
and what debugging of the code has been done? Where and under what circumstances does the debugger indicate that the value is changed?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
But Ontimer's of Page3 set to flag = true. but the data was changing both true and false. how is possible?
Just because of your poor design!
Every page that was activated has its own OnTimer that sets flag to either true for page5 or to false for the others.
All these "processes" run simultaneously so the flag changes quasi-randomly from true to false and back.
Try to stop the timer before leaving the page and restart it after entering (override CPropatyPage::OnKillActive, CPropatyPage::OnSetActive methods)
and what debugging of the code has been done? Where and under what circumstances does the debugger indicate that the value is changed?
I can not find where the value was changed. but when i was run the application, the flag = false in page1 and 2, so the left side bitmap indication sets red color and page3 sets only green color but the result is both red and green indications. This indicates that the value is changed.
I can not find where the value was changed. but when i was run the application, the flag = false in page1 and 2, so the left side bitmap indication sets red color and page3 sets only green color but the result is both red and green indications. This indicates that the value is changed.
Insert TRACE macro to indicate the place and the value in all places where you set this flag. Then start debugging and look at the "output" window...
Don't forget to remove (or, at least comment out) all the afxmessagebox call, since they only disturb debugging.
Insert TRACE macro to indicate the place and the value in all places where you set this flag. Then start debugging and look at the "output" window...
Don't forget to remove (or, at least comment out) all the afxmessagebox call, since they only disturb debugging.
only used break points and watch window to debug my code. don't know, how to use other debugging tools. Today only i used the trace. Its helps me to view the real changes. Thanks and also i will study the documents about how to use the call stack method.
Originally Posted by VictorN
Just because of your poor design!
Every page that was activated has its own OnTimer that sets flag to either true for page5 or to false for the others.Try to stop the timer before leaving the page and restart it after entering (override CPropatyPage::OnKillActive, CPropatyPage::OnSetActive methods)
Yes. Your Correct. I used ON_WM_SHOWWINDOW() method to kill the timer when leave the page and start the timer when enter the page. Its working. Thank you so much.
Last edited by saraswathisrinath; March 13th, 2015 at 11:56 PM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.