|
I agree, thanks Steve!
regards,
George
|
|
|
|
|
Thanks BadKarma,
My question is answered.
regards,
George
|
|
|
|
|
pb is a pointer to a Base , and in the Base class the foo function isn't virtual . This is exactly the behaviour you'd expect.
Steve
|
|
|
|
|
Thanks Steve,
My question is answered.
regards,
George
|
|
|
|
|
dear all friends
the following is my code..i would like to assign value of one array to another array, but why gbest_Ind couldn't be assigned value from p? thanks for your help.
minValue = fitness[0];//fitness is a 10 elements array
for (int count = 0;count<10;count++)
{
if (fitness[count] == minValue )
{
minValue = fitness[count];
gbest_Ind = count;//gbest_Ind is an array of [1][3][4]
}
}
for (int j = 0; j<3; j++)
for (int k = 0; k<4; k++)
{
gbest1[gbest_Ind][j][k]=p[gbest_Ind][j][k];//p is an array of [10][3][4],
}
Li Zhiyuan
|
|
|
|
|
gbest_Ind = count;//gbest_Ind is an array of [1][3][4]
is gbest_Ind an array like your comment suggests or is it an int like this line of code suggests?
|
|
|
|
|
gbest_Ind is an int variable which declared in header file,sorry for my previous mistake
and gbest1 is a [1][3][4] array
Li Zhiyuan
|
|
|
|
|
gbest1[gbest_Ind][j][k]=p[gbest_Ind][j][k];//p is an array of [10][3][4],
and
gbest1 is an array of [1][3][4], so the only valid value for gbest_Ind is 0?
|
|
|
|
|
no, actually gbest_Ind valid value is from 0-9, i just want to use one of 10,and then assign one of 10 p value to gbest1[1][3][4], here when gbest_Ind get a value, and then p [10][3][4] use this value to assign the array to gbest1[1][3][4],how to do it? thanks a lot, i cost two days already, still couldn't get solution.
Li Zhiyuan
|
|
|
|
|
Still not sure what the problem is but, try this
this supposes that array p and array gbest1 are declared something like array[10][3][4]
minValue = fitness[0];
for (int count = 0;count<10;count++)<br />
{ <br />
if (fitness[count] <= minValue )
{<br />
minValue = fitness[count];<br />
gbest_Ind = count;
}<br />
}<br />
<br />
for (int j = 0; j<3; j++)<br />
{
for (int k = 0; k<4; k++)<br />
{<br />
gbest1[gbest_Ind][j][k]=p[gbest_Ind][j][k];
} <br />
}
|
|
|
|
|
Hi friends, plz tell me how can I add controls like -> Buttons to the Child Window.
I have created a SDI, I now I want to add some text to it, & also some button to take input from the users, plzzz tell me how to to this...
Thanx in advance ...
|
|
|
|
|
Can you use of CreateWindow or CButton class?
|
|
|
|
|
tina- wrote: I have created a SDI...
What class is the view derived from?
"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
|
|
|
|
|
i have used the following code
<br />
CButton mybutton;<br />
RECT r;<br />
r.left=100;<br />
r.top=100;<br />
r.right=500;<br />
r.bottom=500;<br />
mybutton.Create("Button",BS_CHECKBOX ,r,this,100);<br />
mybutton.Invalidate();<br />
mybutton.UpdateWindow();<br />
mybutton.ShowWindow(SW_SHOW);<br />
|
|
|
|
|
tina- wrote: mybutton.Create("Button",BS_CHECKBOX ,r,this,100);
What is this ?
"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
|
|
|
|
|
DavidCrow wrote: What is this?
pointer to the parent window, or is that the place i m committing mistake ?
how shall i get the pointer to the parent window ?
|
|
|
|
|
tina- wrote: pointer to the parent window...
Which is a?
"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
|
|
|
|
|
<br />
void CChildView::OnPaint() <br />
{<br />
CPaintDC dc(this);
<br />
<br />
CButton mybutton;<br />
RECT r;<br />
r.left=100;<br />
r.top=100;<br />
r.right=500;<br />
r.bottom=500;<br />
mybutton.Create("Button",BS_CHECKBOX ,r,this,100);<br />
mybutton.Invalidate();<br />
mybutton.UpdateWindow();<br />
mybutton.ShowWindow(SW_SHOW);<br />
}<br />
<br />
|
|
|
|
|
DavidCrow wrote: What class is the view derived from?
-> CWnd
|
|
|
|
|
Of course it is, just like any UI component. But more specifically, what class is the view derived from?
"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
|
|
|
|
|
DavidCrow wrote: Of course it is, just like any UI component. But more specifically, what class is the view derived from?
it is like this ...
class CChildView : public CWnd
|
|
|
|
|
Normally, a view is derived from CView . With your requirement of wanting a button on it, why not use CFormView instead?
"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
|
|
|
|
|
is my code
<br />
void CChildView::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
<br />
CButton mybutton;<br />
RECT r;<br />
r.left=100;<br />
r.top=100;<br />
r.right=500;<br />
r.bottom=500;<br />
mybutton.Create("Button",BS_CHECKBOX ,r,this,100);<br />
mybutton.Invalidate();<br />
mybutton.UpdateWindow();<br />
mybutton.ShowWindow(SW_SHOW);<br />
}<br />
correct enough to display a button ???
|
|
|
|
|
Hello everyone,
CRT is implemented a way that if developer provides DllMain, it will use the provided one, or else the default DllMain is used.
I am wondering how to implement similar selective linking approach? i.e. if there are more than one implementations of a method of the same signature, I can control which one has the higher priority to link, and if the highest priority one does not exist, the second priority one will be used (and compiler will have no duplicated method warning/error).
I do not think CRT implements the approach by using MACRO (if developer provides DllMain, developer needs to define some MACRO, but actually we do not define any macro when writing DllMain) to control the selective linking to DllMain.
Any ideas?
thanks in advance,
George
|
|
|
|
|
Hello everyone,
About the release method implementation of smart pointer of COM, there are two approaches below, and approach 1 is preferred is recommended by Inside COM -- should be better.
Anyone know why approach 1 is better than approach 2?
(m_pI is interface pointer to a COM interface of type T, and it is a member variable of the COM smart pointer class)
Approach 1:
void Release()
{
if (m_pI != NULL)
{
T* pOld = m_pI;
m_pI = NULL;
pOld->Release();
}
}
Approach 2:
void Release()
{
if (m_pI != NULL)
{
m_pI -> Release();
m_pI = NULL;
}
}
thanks in advance,
George
|
|
|
|