|
CBitmapButton m_Btn1;
may be the local variable, got destroyed when out of scope.
|
|
|
|
|
How did you declare m_Btn1?
|
|
|
|
|
Been studying a program for a few days now made by a friend of mine, unfortunately he is not in town to answer some of my questions and i really need to understand this ASAP. I am not going to post the whole program but i will post what i think will help you in understanding my queries for this program
This is a soccer robot program made for MFC C++, two opposing teams Y for yellow and P for purple comprising of 10 players each.
This was how the players initial position was declared:
P[0].x = 158; P[0].xi = P[0].x;
P[0].y = 100; P[0].yi = P[0].y;
Declaration for soccer balls initial position:
balx = 325;
baly = 225;
Initializes value for close:
for(int l=0;l<11;l++)
{
Y[l].close = false;
P[l].close = false;
}
//computes for the distance between the ball and the players
for(int m=0;m<11;m++)
{
Y[m].dist = sqrt(pow((Y[m].x-balx),2)+ pow((Y[m].y-baly),2));
P[m].dist = sqrt(pow((P[m].x-balx),2)+ pow((P[m].y-baly),2));
}
Finds the shortest distance between the dark blue players and the ball:
(ALSO DONT UNDERSTAND why y[n].dist was compared to y[p].dist, are they not the same value? Can someone explain why the need for true and false?)
Y[0].close=true;
p=0;
for(int n=0;n<10;n++)
{
if(Y[n].dist < Y[p].dist)
{
Y[p].close=false;
p=n;
Y[n].close=true;
}
}
THIS CODE I DO NOT UNDERSTAND: Please explain what the true and false is for for the .close
Close was declared as a bool. I get everything except the need for the true and false with regards to .close Close was supposed to determine which among the players in the team was nearest to the ball.
if(P[s].close!=true)
{
if(P[s].xi
{P[s].x-=1;}
else {P[s].x+=1;}
if(P[s].yi
{P[s].y-=1;}
else {P[s].y+=1;}
}
Thank you very much, any help would be highly appreciated.
This is a repost, my apologies to the mods but i dont know where i posted my previous one. This will not happen again.
|
|
|
|
|
dopeman wrote: (ALSO DONT UNDERSTAND why y[n].dist was compared to y[p].dist, are they not the same value? Can someone explain why the need for true and false?)
Y[0].close=true;
p=0;
for(int n=0;n<10;n++)
{
if(Y[n].dist < Y[p].dist)
{
Y[p].close=false;
p=n;
Y[n].close=true;
}
}
Well Y[n].dist and Y[p].dist are the same value only on first iteration, you can avoid this unnecessary (though it is not a mistake) comparison starting from 1 the iteration:
for(int n=1;n<10;n++)
dopeman wrote: if(P[s].close!=true)
{
if(P[s].xi
{P[s].x-=1;}
else {P[s].x+=1;}
if(P[s].yi
{P[s].y-=1;}
else {P[s].y+=1;}
}
Probably this piece of code makes the players (except the one closest to the ball) to move towards the ball itself, but it really depends on how P[s].xi and P[s].yi are computed, you didn't show that.
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
|
|
|
|
|
Thanks for the help, really appreciate it
declarations:
P[0].x = 158; P[0].xi = P[0].x;
P[0].y = 100; P[0].yi = P[0].y;
i think you are right, the code below is for the player not closest to the ball and it makes it try to follow the ball.
if(P[s].close!=true)
{
if(P[s].xi<p[s].x)>
{P[s].x-=1;}
else {P[s].x+=1;}
if(P[s].yi<p[s].y)>
{P[s].y-=1;}
else {P[s].y+=1;}
}
What i dont understand is the need to compare P[s].yi<p[s].y ,="" is="" that="" the="" original="" point="" of="" orgin="" being="" compared="" to="" new="" origin="" was="" moved="" by="" a="" random="" number="" on="" both="" x="" and="" y="" axis?<br="" mode="hold">
Now as for this code:
Y[0].close=true;
p=0;
for(int n=0;n<10;n++)
{
if(Y[n].dist < Y[p].dist)
{
Y[p].close=false;
p=n;
Y[n].close=true;
}
}
I still dont get it The program is supposed to determine using this code which one is the closest to the shortest distance computed between the ball and the player right? so how does this compare?
|
|
|
|
|
Hi,
I am getting the following error.Please help me in solving it.
Debug\vc60.pdb" is missing debugging information for referencing module
Regards,
Mayank
|
|
|
|
|
Maynka wrote: I am getting the following error.Please help me in solving it.
Actually it is a warning.
What is the module without debugging information?
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
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everybody!
I use a static lib (ANSI because of 3rd company libs included there which requires ANSI) and would like to use it in a unicode application.
Does someone know from expierence if there are any problems??
does some have further information, because it's very hard to find information about this topic??
Thanks and best regards
Mathias
|
|
|
|
|
neyerMat wrote: Does someone know from expierence if there are any problems??
No problems, provided you convert strings from you application before passing them to the library and viceversa.
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
|
|
|
|
|
Thanks Pallini!
I never thougt that simple!
so long
Mathias
|
|
|
|
|
And as a side note, u even don't want to convert the strings, provided u r using the ANSI version of API for that particular strings
|
|
|
|
|
Using HtmlHelp with HH_DISPLAY_TEXT_POPUP to display a context-sensitive help in arabic, where the extended style of the owner window is set to WS_EX_LAYOUTRTL, results in displaying the help-text in a correct right-to-left order, but the entire multiline text is still left-aligned.
How do I set the right-alignment of the text in the help-popup window ?
|
|
|
|
|
I must install which Windows Components before I install Visual Stduio 2003?
I insert the CD1 of VS2003, it always tell me to restart computer.
The restart message is as below:
http://www.game.csie.ndhu.edu.tw/~akira/Else/vs2003error_eng.JPG
|
|
|
|
|
|
i am using windows XP and Visual Studio 2005
|
|
|
|
|
Have a look at [^]. It is a .NET article, I know, but may be useful.
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
|
|
|
|
|
dear all
how to determine size of Gaussian mask when sigma is changed? any formula is available for this case. thanks a lot.
Li Zhiyuan
|
|
|
|
|
Why don't you google for? [^]
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
|
|
|
|
|
thanks, brother, i searched for many times, couldn't get it.
Li Zhiyuan
|
|
|
|
|
i have project which contains a service application and window based application, When the window receive a message i need to pass some information regarding message ( a structure ) to the service. How to do that ?
Thanks
|
|
|
|
|
I once did that using COM connection points, it was hard but very fast. A Windows Sockets loopback would probably have been easier, any form of IPC (InterProcess Communication) would do the trick but stay away from DDE (Devilish Data Exchange). Some people get on with memory mapped files and other don't. Rumours of COM runtime shared memory implementations persist despite the horror of such a thing and there are all sorts of off the shelf bits of middle ware and messaging frameworks gathering dust and waiting for someone to turn them into applications.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
have a look at ControlService() API and make of user-defined control code.
if not suitable, i think IPC is the option as mathew already said.
|
|
|
|
|
Rajkumar R wrote: have a look at ControlService() API and make of user-defined control code.
It looks like that ControlService can only send code but can not take additional data with the code?! (Something like wParam and lParam stuff)
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: It looks like that ControlService can only send code
yes.
Maxwell Chen wrote: but can not take additional data with the code?! (Something like wParam and lParam stuff)
he doesnot want to pass the Window message as it
nitin3 wrote: When the window receive a message i need to pass some information regarding message ( a structure ) to the service.
he want to pass some info regarding the message.
if he can do it as unique code, much of work to implement IPC is avoided. otherwise IPC, that already i meantioned in my reply.
|
|
|
|