|
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.
|
|
|
|
|
There is just one version of code and I just change Solution configuration from debug to release, so temp is consistent.
Whole program simulates WLAN with EDCA (802.11e). BEload:execute() function generates packets MSDU for one single station, which means it generates offered traffic = offered load. It decides (draws) whether just arrived packet will be sent in UPLINK or DOWNLINK. upLinkRatio variable states what % of all packets generated by BEload:execute() function will be sent in UPLINK. When the random double temp that varies from 0 to 1 is smaller than upLinkRatio (let's say smaller than 0.2 - let's assume upLinkRatio = 0.2), generated packet will be sent in UPLINK. It means address of source and transmitter will be set to address of station, and destination address to 0 (which is the address of access point - AP):
if (temp < upLinkRatio){
msdu->DA = 0;
msdu->TA = msdu->SA = staAddress;
}
Otherwise source and transmitter addresses will be set to address of AP (0) and destination adress to address of station.
else{
msdu->SA = msdu->TA = 0;
msdu->DA = staAddress;
}
So the problem is that proportion of offered traffic in UPLINK and DOWNLINK for RELEASE version are inverted. 80% of packets are offered in UPLINK, instead of 20%.
After changing statement you quoted to:
if (temp > upLinkRatio){
20% of packets are offered in UPLINK instead of 80% (of course just inthis case, when conditional statement is "inverted").
|
|
|
|
|
mass85 wrote: There is just one version of code and I just change Solution configuration from debug to release, so temp is consistent.
So you're saying that somehow the values of the '<' and '>' operators are being inverted by the compiler! I would suggest that it is much more likely that either the value of temp or upLinkRatio takes a different value depending on whether or not DEBUG is set. Try putting some extra code in there to see exactly what values are being used.
|
|
|
|
|
OK. I've changed conditional statement, so there's no upLinkRatio variable just constant value 0.2. And I also added cout<<temp;
the result="" is="" quite="" strange.="" most="" of="" the="" temp="" values="" are="" 0...="" which="" course="" incorrect.="" do="" you="" know,="" what="" might="" be="" reason="" for="" that?="" i="" will="" looking="" anything="" suspicious="" in="" generator,="" but="" it="" hard="" to="" find...="" example="" function="" gettimebe="" returns="" correct="" values.
here="" parts="" code="" that="" can="" affect="" beload="" from="" generator="" (this="" class="" used="" generate="" pseudo="" random="" numbers):
<pre="">
class Generator{
private:
int a, h, q, r, m;
int *coreCRC;
int **coreCW;
int *coreTimeBE;
int *coreTimeBK;
int *coreUpLinkRatio;
int *coreBurst;
int *corePacket;
int uniform(int X){
h = int ( double (X) / q );
X = a*(X - q*h) - r*h;
if (X < 0) X = X + m;
return X;
}
public:
double getTimeBE(int staAddress, double intensity){
int x = uniform(coreTimeBE[staAddress]);
coreTimeBE[staAddress] = x;
return (-1/intensity * log(double(x)/m));
}
double getUpLinkRandom(int staAddress){
int x = uniform(coreUpLinkRatio[staAddress]);
coreUpLinkRatio[staAddress] = x;
return double(x)/m;
}
void initialize(){
coreCW = new int*[staNr];
coreUpLinkRatio = new int[staNr];
coreBurst = new int[staNr];
coreTimeBE = new int[staNr];
coreTimeBK = new int[staNr];
corePacket = new int[staNr];
for(int i = 0; i < staNr; i++) coreCW[i] = new int[AC];
coreCRC = new int[staNr];
int x = 17;
int msgs = int (5*msgsToObserve*(1 + transientPhase/simTime));
for (int i = 0; i < staNr; i++){
for(int j = 0; j < AC; j++){
coreCW[i][j] = x;
for(int k = 0; k < (runsNr*(10*msgs + 3*shift + runShift)); k++)
x = uniform(x);
}
}
////////////////
// code omitted
///////////////
for(int i = 0; i < AC; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
}
Generator() : a(69621), q(30845), r(23902), m(2147483647) {}
};
|
|
|
|
|
You know, it's very hard to find mistakes in snippet of code that may also be error-free (the mistake may be, for instance in the omitted code). Your best bet is a uninitialized variable (in the posted code, for instance m appears to be such).
BTW have a look the classical article "Surviving the Release Version".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thx for the link.
a, q, r, m are initialized in constructor.
|
|
|
|