|
STest needs to have an overloaded equals operator.
I recommend you make FinalArray an array of pointers to STest. Then you won't have to worry about it and you'll prevent a potential performance problem.
|
|
|
|
|
Since you are storing an array of objects, rather than an array of pointers, the objects will be copied into the array. This means that C++ uses the autogenerated assignment operator for STest. However, the CArray template class disables both the copy constructor and the assignment operator, therefore disabling simple copies of the array.
There are a number of solutions for this. Here's a few:
1) Store STest pointers in the outer array instead of objects. This means that only the pointers are copied rather than the entire object (and hence the inner CArray is not copied). This means that the objects must be allocated and deallocated manually on the heap.
2) Use std::vector instead of CArray. This is much better implementation overall, and does not have the copying limitation either.
BTW, when posting on codeproject, use < and > instead of < and >, otherwise they look like HTML tags and so are not displayed.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
This is how you create a CArray that holds structures.
typedef struct {
int IndexNumber;
CArray Data;
} structName;
CArray<structname,structname&> m_caFinalArray;
Then to add data you must add it like this:
structName m_tempStruct;
m_tempStruct.IndexNumber=1000000000000000000; //whatever number you need
m_tempStruct.Data=blah; //more data
m_caFinalArray.Add(m_tempStruct);
-Steven
CPACodeProjectAddict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
So far i've set up a timer for 1000ms and each WM_TIMER event I capture the screen and save it to a BMP. If I wanted to record at 12 FPS how would I do this...?
Would I basically setup a counter and stop recording when it reaches 12?
How do I ensure I get 12 frames per second?
Also when playing the images back, how would I allow some frames to have differ delays?
p.s-If you know of any code on CP or wherever than would convert 24bit images to 8bit RLE encoded, please let me know...
Thanks.
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
You could set your timer to 83ms which would happen roughly 12 times per second.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Cool idea, I didn't even think of that...
Thanks
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
Remember the WM_TIMER timer is not high-res - i.e. it is not guaranteed to fire exactly when it is set to fire.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hi,
I have an ActiveX control and its dependend DLLs within a CAB file that we use within our web application. I also use this same control in a fat VC client. We currently deploy the control for our fat client by an install shield script. I'd like to get away from having to deploy this control, since I know it's sitting on a local web server in a cab file.
Is there an API set that allows me to reference the CAB file rather than bundling the control in my setup script? In other words, I'd like my fat client to instantiate the object via an http call to my web server and pull down the control rather than me having to wrap it in my install script. Any ideas appreciated.
Ron Ward
|
|
|
|
|
Hi all
I want to buy a Sony 17'' LCD monitor and I need some help .
First I haven't found much ratings/reviews about this monitor . If anybody has used this type maily for programming please write me .
I have found a sigle review but this is in french . Can somebody translate it?
I would greatly appreciate
"....
le + beau ( vaux mieux pour le prix )
17" 500/1 16ms décoiffant
si vous en avez les moyens achetez-le.
....."
The URL is:
http://www.ldlc.fr/critiques/PB00016180_1.html
Thanks a lot
Jancsi
|
|
|
|
|
jancsi wrote:
vaux mieux pour le prix
Best value for the price
jancsi wrote:
si vous en avez les moyens achetez-le
If you have the means, buy it
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
jancsi wrote:
le + beau ( vaux mieux pour le prix )
Most beautifull (fortunately at this price)
|
|
|
|
|
I don't know how to delete a file in mfc.
|
|
|
|
|
|
DeleteFile(pFileName)
Ever try actually reading the documentation?
Hell ever try the obvious?
|
|
|
|
|
My problem is more complicating than just one line:
DeleteFile(pFileName). In order to delete a file, you need to let the user search for a file first. I also need to create a progress dialog page.
|
|
|
|
|
Have you tried messing with CFileDialog to get the user selected file. Something like this could do (not tested)...
CFileDialog File(TRUE, NULL, NULL);
if (File.DoModal == IDOK)
{
DeleteFile(File.GetPathName);
}
</code>
That should give the basic idea!
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
You don't need a progress dialog to delete a file. It's a one-step operation that takes but a second.
|
|
|
|
|
Im writing a C++ program, and I need to add a member variable to a class. This member variable is an object that takes 2 parameters to it's contructor. How do I declare the variable in the header of my class, and initialize it in the constructor of the class that I am using it in?
ROY! Please don't go!
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
class Fred
{
Fred() : x(whatever, whatever)
{
}
CFoo x;
};
<pre>
<hr>
<font size="-2" color="#6060af">Image tools: <a href="http://www.smalleranimals.com/thumb.htm">ThumbNailer</a>, <a href="http://www.smalleranimals.com/bobber.htm">Bobber</a>, <a href="http://www.smalleranimals.com/tiffass.htm">TIFFAssembler</a></font>
|
|
|
|
|
When you hit the enter key in VS6 it inserts "\r\n" which drops you down a line. This is normal behavior in windows, however I'm editing C++ files that are being used in unix and the \r is an annoyance there.
My question is, does anyone know how to stop VS from inserting the \r -or- Is there a way to run a small script that would strip this out when you save the file?
-Jack
|
|
|
|
|
Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)"
Unfortunately, this applies only to the active file (note the singular).
|
|
|
|
|
Is this in VC++ 6.0 ? Because I don't see "Advanced Save Options" under the File menu.
Thanks,
Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Sorry, I was thinking VC7.
I don't believe there is a solution in VC6 except to write a little program. (In fact VC6 will take files that have just LF and convert them automatically to CR/LF. By default, VC7 will preserve the original style.)
|
|
|
|
|
Mine seems to be preserving the original style. It only inserts the \r when I add a line.
Do you happen to know if it is possible to write a little script/program and have it be ran on the file when you hit save? Like a filter or something.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
There is an event to tell you a document has been saved, but I don't think there is the ability to do what you want.
One solution would be to write an add-in and call it directly.
|
|
|
|