|
you better read some articles here at CP and beginner books to get an overview of some class libraries of your choice as MFC, ATL.
The time you invest infront you get paid back very quick.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi
From MSDN:
"It is not necessary to wait until creation of the property sheet window to call AddPage. Typically, you will call AddPage before calling DoModal or Create."
Usually, each "Page" "OnInitDialog()" is called after it is first clicked.
Can I get CPropertyPage to be created before it is first click?
Can I get each CPropertyPage "OnInitDialog()" to be called before the "page" is clicked?
Best regards,
|
|
|
|
|
transoft wrote: Can I get CPropertyPage to be created before it is first click?
Yes. Check out the PSP_PREMATURE style.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
you better understand the purpose of "OnInitDialog()", which means that THIS CODE had to get executed for the proper initialization RIGHT BEFORE showing the page.
If you have some operations, do it somewhere else!!!
I prefer threads for long operations, because they dont stop the GUI.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I have to call GetDlgItem(..) which has to be called within "OnInitDialog()". I tried different ways before I post this message here.
I know the purpose of "OnInitDialog(). Because there are a lot of expert here, I post my question.
Thanks,
|
|
|
|
|
if the dialog isnt visible it isnt necessary to call GetDlgItem(..). If yoz have to change a value of a control, store the value in a member and change it in the OnInitDialog()
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Mr. DavidCrow already gave me solution.
|
|
|
|
|
I digged further about it and found:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/c6dc6a9a-0136-41e8-8bb8-2b92366d98e2/
the flags isnt supported anymore
But what is with OnSetActive() ?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi
I did following in CPropertyPage's constructor:
m_psp.dwFlags |= PSP_PREMATURE;
After debuging, I found that "OnInitDialog()" was called (after "AddPage") before it is clicked.
From my debuging, following statement (item 3) is not true.
1. OnInitDialog() fires for the first property page (the one all the way to the left).
2. OnSetActive() fires for the first property page.
3. OnInitDialog() then fires for each remaining property page, from left to right.
Thanks
|
|
|
|
|
An Addition OnSetActive() fires for every property page EVERY time it is clicked. So it is first choice for updating data. [->OnKillActive()]
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
|
the better way for my case is:
#pragma warning (error: 4245)
but both level 4 or this can not show warning:
UINT u;
if(u<0)
{
}
Thanks
|
|
|
|
|
I hope to get warning message at compiling time for:
UINT u=-1;
and
u=-1;
and
if(u<0)
{
....
}
because I modified data type of User ID from int iUserID to UINT uUserID, thousands of places had used -1 as invalid user ID (now is 0 for UINT), it is very hard to find all places to modify if without warning instructions.
Is it possible?
|
|
|
|
|
includeh10 wrote: I hope to get warning message at compiling time for:
And what happens when you compile it?
|
|
|
|
|
nothing, no error, no warning.
|
|
|
|
|
Try setting compiler warning level to 4 (/W4) in the C/C++ General properties of the project.
|
|
|
|
|
yes, I just did:
#pragma warning (push, 4)
|
|
|
|
|
better use the project setting, so it works in all files.
Check to what the UINT macro resolves.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi
I have a strange situation. My simulation written in VS 2008 return wrong results for release version of program run from HDD. When I run this program for the same set of parameters from the VS using release or debug version, or when I run debug version from HDD, I get correct results.
What's more interesting I can interpret wrong results. They look like they were generated by wrong parameter or wrong conditional expression in one single line.
Here is the correct code:
double temp = generator.getUpLinkRandom(staAddress);
t += temp;
cntr++;
if (temp < upLinkRatio){
msdu->DA = 0;
msdu->TA = msdu->SA = staAddress;
}else{
msdu->SA = msdu->TA = 0;
msdu->DA = staAddress;
}
I set the upLinkRatio to 0.2, but wrong results look like upLinkRatio was set to 0.8 or optimiser changed conditional expression to:
if (temp > upLinkRatio)
I tested the generator's average and it's correct (0.5, this is uniform generator, return values from 0 to 1). I cleaned project, deleted all object files. I made sure that all files with parameters are exactly the same. And still can't find the reason.
Edit:
There's something even more interesting. Just for curosity I changed this conditional expression to the wrong version and now the situation is exactly opposite. Relaese version run from HDD returns correct results, whereas all other wrong (which is what I expect - code is wrong).
So it looks like there is something wrong with compiler/builder... But what? Please help.
|
|
|
|
|
i'd start checking for uninitialized variables.
|
|
|
|
|
There are no uninitialized variables in this block of code. I don't think there are any in whole program. I can't understand how uninitialized variables could result in such a behaviour of program.
|
|
|
|
|
mass85 wrote: There are no uninitialized variables in this block of code. I don't think there are any in whole program.
But are you sure?
mass85 wrote: I can't understand how uninitialized variables could result in such a behaviour of program.
I think in DEBUG code all stack space is initialised to 0xCCCCCCCC (or similar) on entry to a function, which helps the debugger to diagnose exactly this problem. It certainly sounds like a value is being set wrongly or mis-computed somewhere.
|
|
|
|
|
But do you think I can look for the uninitialized variable within the function part of which I presented here and all objects that are used by this function? Or maybe I should look through whole code?
This is the code of the function:
void BEload::execute(){
MSDU *msdu = new MSDU();
msdu->ac = 2;
msdu->type = DATA;
msdu->arrivalTime = msdu->staArrivalTime = clock;
msdu->id = id++;
double temp = generator.getUpLinkRandom(staAddress);
t += temp;
cntr++;
if (temp < upLinkRatio){
msdu->DA = 0;
msdu->TA = msdu->SA = staAddress;
}else{
msdu->SA = msdu->TA = 0;
msdu->DA = staAddress;
}
Mac *s = sta[msdu->SA];
msdu->RA = s->routing[msdu->DA];
msdu->bitrate = s->bitrate[msdu->RA];
msdu->size = packetSize;
if (msdu->size + overhead > s->fragmTSH){
double fragments = double (msdu->size)/(s->fragmTSH - overhead);
if (fragments != int(fragments)) fragments = int (fragments + 1);
msdu->fragments = int(fragments);
msdu->lastFragmSize = int(msdu->size - (s->fragmTSH - overhead)*(fragments - 1));
}else
msdu->fragments = 1;
s->bufOUT[2].insertLast(msdu);
time = clock + generator.getTimeBE(staAddress, intensity);
agenda.schedule(this);
}
double Generator::getUpLinkRandom(int staAddress){
int x = uniform(coreUpLinkRatio[staAddress]);
coreUpLinkRatio[staAddress] = x;
return double(x)/m;
}
Constructor of MSDU initializes all of MSDU's variables. t, cntr and upLinkRatio are members of BEload and are initialized by BEload's constructor and upLinkRatio is later changed to the value of global upLinkRatio variable (this global variable is not needed anymore, but could it cause any problems? I don't think so.). All variables in Generator class are initialized too.
|
|
|
|
|
From your earlier message you implied that this statement
if (temp < upLinkRatio)
may be the problem. Are you sure the value of the temp variable is consistent in DEBUG and RELEASE modes? As I do not really understand how all of this code works I can't speculate as to any other places to look.
|
|
|
|