|
The last argumen of button.Create is button id. You can use it in message map
CButton *pButton = new CButton;
pButton.Create(WS_VISIBLE|WS_CHILD,CRect(10,10,110,30),this,1 /*Id of the button any id which is unique*/ );
void OnHandler(void)
{
// Something
}
ON_BN_CLICKED(1 /* Last argument of create */,OnHandler)
MANISH RASTOGI
|
|
|
|
|
manish rastogi wrote: ON_BN_CLICKED(1 /* Last argument of create */,OnHandler)
He cannot use a message map as buttons are created dynamically.
Owner drawn
Jesus Loves
|
|
|
|
|
He can if he knows what the ID's will be at compile time...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
True. But it's not flexible.
Owner drawn
Jesus Loves
|
|
|
|
|
Is there a way to dynamically create an ID?
|
|
|
|
|
ID acts as a unique identifier for the control that you are creating. So make sure that they are unique.
Owner drawn
Jesus Loves
|
|
|
|
|
I realize that, so is there any way to ask the framework to return a unique ID
|
|
|
|
|
Look in the header 'Resource.h'. Near the bottom of the file you should see an entry that looks something like:
#define _APS_NEXT_CONTROL_VALUE 1021
(The actual number in the definition depends on your particular project.)
You can use this MACRO as the value for your first dynamically created control. Just keep incrementing the value to get a new unique value for each dynamic control.
Dan
Remember kids, we're trained professionals. Don't try this at home!
|
|
|
|
|
Look up CreateWindow() in the MSDN, a button is just another window. Setting the dwStyle parameter to BUTTON should produce a button. You will need to do a little studying to figure out how to handle the result of pressing the new button, it easier to figure out in C than when using MFC.
INTP
Every thing is relative...
|
|
|
|
|
look a this Link[^]
codito ergo sum
|
|
|
|
|
Hello,
Lets assume I have two different graphic effects: a particle system (stars coming out of teh center of the screen) and a simple rotating cube. Both consist of textures which have a z-value when blitted / written into the render-pipeline. I want the particle-stars (although their z-value gets lower if they come nearer) to be always behind the cube. It could be possible thet one of the particles suddenly pops out of the cube, thats not wanted.
Someone told me that I should erase the zbuffer before drawing the next layer. Is that possible in DirectX8 and can solve my problem?
Thank you,
Chris
|
|
|
|
|
Hi,
Can anyone suggest me some good books in implementing code for image/video frames processing in c++. I would like to learn programming some image processing techniques and to create programs where I can apply transforms, shifts and find some characteristics from the video frames of images in visual c++. It would be great if anyone can suggest me with good books or tutorials with loads of image/video frame grabbing/processing programming discussed extensively.
thanks,
-Pav
|
|
|
|
|
If you don't mind using OpenCV this might help[^]
As for books when I looked a couple of years ago there weren't any decent books on directshow[if you want to use that], though there were some in the pipelines.
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
Hi,
thanks for ur reply.
Ok here u go. I am thinking of learning pattern recognition and extraction of charateristics. so, i thought it would be better to start off with some good image processing coding books in c++. for example, I would like to find the blood velocity from a video file of retina from a patient, in which I can see the blood vessels flowing. From all the frames my goal is to find out the velocity of blood. Hope u understand the track in which i am thinking of .
thanks,
-Pav
|
|
|
|
|
Are you looking for an book with c++ algorithims for image processing? If so I am not really familiar with any that deal with estimating speed of movement[in your case do you have to worry about depth?] but there are many that deal with subject but not as an 'algorthim book for c++'
The Quran's Rational Arguments (Audio)
Background on Prophet Muhammad (in progress)
"They are MUSLIM. It does not matter how you split it up: all msulims (so they say) see every other muslim as a brother, regardless of origin or nationality." -legalAlien. Alhamdullah for the blessing of Islam
|
|
|
|
|
Are you looking for an book with c++ algorithims for image processing?
yes, but not just algorithms. I would like to see the coding part too on how to enhance the processing time and computation speeds.
[in your case do you have to worry about depth?]
Nope. To say we will be having a movie from which we have to find the velocity
'algorthim book for c++'
I need some sort of this type but for image processing/handling.
I always wonder how people write codes for media players etc in C/C++ with all sorts of functions like capturing frames saving as images etc.
-Pavan.
|
|
|
|
|
Hi all, maybe somebody can help me out with this.
if i do this:
class CSomeClass
{
......
};
CArray <csomeclass, csomeclass&=""> objSomeClassArray;
CSomeClass objSomeClass;
objSomeClassArray.Add(objSomeClass);
...
objSomeClassArray.RemoveAll();
my question is:
does the RemoveAll() method in this case free also the memory?
if not what should i do to free them?
thanks a lot
|
|
|
|
|
In your example, I believe memory is naturally freed. However, if you created the ObjSomeClass via the heap (using new), you would have to manually free the memory via delete.
|
|
|
|
|
This is what MSDN says about it:
Notice the difference between deleting an element's object and removing the element itself. Removing an element from the list merely removes the list's reference to the object. The object still exists in memory. When you delete an object, it ceases to exist and its memory is reclaimed. Thus, it is important to remove an element immediately after the element's object has been deleted so that the list won't try to access objects that no longer exist.
CArray<CPerson*, CPerson*> myArray;
<font color=blue>int</font> i = 0;
<font color=blue>while</font> (i < myArray.GetSize() )
{
<font color=blue>delete</font> myArray.GetAt( i++ );
}
myArray.RemoveAll();
Owner drawn
Jesus Loves
|
|
|
|
|
Objects are usualy responsible for freeing the memory they use. If your CArray is storing objects, then they will free the memory when they are removed. But if the CArray is only storing pointers to objects, then you are responsible for freeing the memory [associated with each object]. The reason for this is that the array object does not actualy know whether it is storing an object or a pointer to an object.
INTP
Every thing is relative...
|
|
|
|
|
consider the small situation:-
funcFCC()
{
ClassA a;
}
here the object is destroyed when the function scope end....
funcFCC()
{
ClassA *a=new ClassA;
}
here the Memory is not freed when scope of function end.. resulted in memory leak...
same apply for the RemoveAll function.. hope you understand this!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
thanks for all the responses,
please look at this code:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&> & pSomeClassArray)
{
CSomeClass objSomeClass;
pSomeClassArra.Add(objSomeClass);
......
}
void COtherClass::SecondFunction()
{
// m_objSomeClassArray is a member variable array of COtherClass (Type CSomeClass)
FirstFunction(&m_objSomeClassArray);
......
m_objSomeClassArray.RemoveAll();
}
is this OK?
|
|
|
|
|
Kleser wrote:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&> & pSomeClassArray)
{
CSomeClass objSomeClass;
pSomeClassArra.Add(objSomeClass);
......
}
void COtherClass::SecondFunction()
{
FirstFunction(&m_objSomeClassArray);
......
m_objSomeClassArray.RemoveAll();
}
Is CSomeClass implement the copy constructor?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i made a mistake writing the code above. it has to look like this:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&>* pSomeClassArray)
{
....
}
instead of this:
void COtherClass::FirstFunction(CArray<CSomeClass, CSomeClass&>& pSomeClassArray)
{
....
}
the method has a pointer parameter instead of a reference parameter.
i guess CSomeClass does not implement a copy constructor, i have not added anything in the constructor neither write a new constructor in that class.
i use the class the way it is as i show you before, and it seems to work.
but i want to know how to implement a copy constructor, can you please show me how to do it?
thanks in advance
|
|
|
|
|
Hi, i have a problem with this code i am working on. It does compile correctly but when i input my data file, which is a string of integers it does not seem to work.. pls advice if possible
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main(){
FILE*scores;
float s,y,z,mean,deviation,m,n,A,B,C,D,F;
int k,a,b,c,d,f,q;
scores=fopen("scores.txt","r");
a=b=c=d=f=k=q=0;
s=y=z=mean=deviation=m=n=A=B=C=D=F=0;
while(fscanf(scores,"%f",&s)!=EOF){
y+=s;
z+=(pow(s,2));
k++;
if(90<=s<=100){
a++;
}else if(80<=s<=89.9){
b++;
}else if(70<=s<=79.9){
c++;
}else if(60<=s<=69.9){
d++;
}else{
f++;
}
}
printf("%d\t%d\t%d\t%d\t%d\n",a,b,c,d,f);
mean=y/k;
printf("The average score is %.1f.\n",mean);
m=z/k;
n=pow(mean,2);
deviation=sqrt(m-n);
printf("The standard deviation is %.1f.\n",deviation);
A=a/k*100;
B=b/k*100;
C=c/k*100;
D=d/k*100;
F=f/k*100;
printf("\nA\t%d\t%4.1f\t",a,A);
for(q=1;q<=a;q++){
printf("*");
}
printf("\nB\t%d\t%4.1f\t",b,B);
for(q=1;q<=b;q++){
printf("*");
}
printf("\nC\t%d\t%4.1f\t",c,C);
for(q=1;q<=c;q++){
printf("*");
}
printf("\nD\t%d\t%4.1f\t",d,D);
for(q=1;q<=d;q++){
printf("*");
}
printf("\nF\t%d\t%4.1f\t",f,F);
for(q=1;q<=d;q++){
printf("*");
}
printf("\n");
This code is suppose to calculate mean, std deviation and print a bar chart to represent the distribution.
|
|
|
|