Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Random Numbers Pin
Kevin McFarlane20-Feb-05 4:39
Kevin McFarlane20-Feb-05 4:39 
GeneralRe: Random Numbers Pin
nadzzz20-Feb-05 7:22
nadzzz20-Feb-05 7:22 
GeneralRe: Random Numbers Pin
David Crow21-Feb-05 4:24
David Crow21-Feb-05 4:24 
GeneralCreate Dynamically Generated Arrays Pin
OutlawTornNMT19-Feb-05 16:50
OutlawTornNMT19-Feb-05 16:50 
GeneralRe: Create Dynamically Generated Arrays Pin
Maximilien20-Feb-05 3:38
Maximilien20-Feb-05 3:38 
GeneralRe: Create Dynamically Generated Arrays Pin
OutlawTornNMT20-Feb-05 14:42
OutlawTornNMT20-Feb-05 14:42 
GeneralRe: Create Dynamically Generated Arrays Pin
Ryan Binns20-Feb-05 17:10
Ryan Binns20-Feb-05 17:10 
GeneralRe: Create Dynamically Generated Arrays Pin
LighthouseJ20-Feb-05 8:01
LighthouseJ20-Feb-05 8:01 
Or you could derive a custom class from CObject of whatever you want to put in there. For instance, I have this class in my current project:

class CBitmapObject : public CObject {<br />
public:<br />
CBitmapObject (BYTE newColor, int newCount) { <br />
color = newColor;<br />
count = newCount;<br />
}<br />
~CBitmapObject(void);<br />
BYTE getColor () { return color; }<br />
int getCount () { return count; }<br />
private:<br />
BYTE color;<br />
int count;<br />
};


then I have a CObList named m_bitmapDataArray that adds items like this:
m_bitmapDataArray->AddHead(new CBitmapObject(currentColor, count));
You can add things at the end (Tail) or anywhere in between.

Later I use this code to pull objects off the end and perform the proper functions on them like this:
CBitmapObject *next;<br />
next = (CBitmapObject*) m_bitmapDataArray->RemoveTail();

You'll get an error because the RemoveTail() returns a CObject but my class is called CBitmapObject so you can recast CObject because CBitmapObject inherits CObject things.

I can create a CObList or CObArray collection of these classes derived from CObject. The CObArray works just like a regular array, with indices. CObList is more like an advanced doubly-linked list. You can add/remove from the head of tail of the list, or insert new objects at a particular location, etc...

If you can rearrange your project if it's more convenient to make a class derived from CObject to describe your entire device or however you care to use it, it might help out a lot. Hope this helps, good luck.
GeneralCFtpConnection::GetFile Directory Issues Pin
JimmyGoon19-Feb-05 16:11
JimmyGoon19-Feb-05 16:11 
GeneralRe: CFtpConnection::GetFile Directory Issues Pin
JimmyGoon21-Feb-05 10:46
JimmyGoon21-Feb-05 10:46 
QuestionSIMPLE QUESTION!!! WHAT STUPID THING AM I DOING WRONG??? Pin
...---...19-Feb-05 11:46
...---...19-Feb-05 11:46 
AnswerRe: SIMPLE QUESTION!!! WHAT STUPID THING AM I DOING WRONG??? Pin
Michael Dunn19-Feb-05 11:56
sitebuilderMichael Dunn19-Feb-05 11:56 
GeneralRe: SIMPLE QUESTION!!! WHAT STUPID THING AM I DOING WRONG??? Pin
...---...19-Feb-05 12:13
...---...19-Feb-05 12:13 
AnswerRe: SIMPLE QUESTION!!! WHAT STUPID THING AM I DOING WRONG??? Pin
macrophobia19-Feb-05 17:50
macrophobia19-Feb-05 17:50 
AnswerYour solution Pin
David Nash22-Feb-05 21:25
David Nash22-Feb-05 21:25 
GeneralMFC + Images + Drawind +Saving Pin
Niewiem19-Feb-05 11:33
Niewiem19-Feb-05 11:33 
GeneralVirtual Keys Pin
CodyDaemon19-Feb-05 11:18
CodyDaemon19-Feb-05 11:18 
GeneralRe: Virtual Keys Pin
Neville Franks19-Feb-05 11:40
Neville Franks19-Feb-05 11:40 
GeneralRe: Virtual Keys Pin
Michael Dunn19-Feb-05 12:03
sitebuilderMichael Dunn19-Feb-05 12:03 
GeneralRe: Virtual Keys Pin
Justin Cobb (Guest Mode)21-Feb-05 7:48
sussJustin Cobb (Guest Mode)21-Feb-05 7:48 
GeneralProcess launching Pin
Masud Alipour19-Feb-05 11:09
Masud Alipour19-Feb-05 11:09 
GeneralRe: Process launching Pin
Michael Dunn19-Feb-05 12:07
sitebuilderMichael Dunn19-Feb-05 12:07 
QuestionRe: Process launching Pin
J.B.22-Sep-08 4:10
J.B.22-Sep-08 4:10 
GeneralExit Error, revisited (updated) Pin
LighthouseJ19-Feb-05 10:18
LighthouseJ19-Feb-05 10:18 
GeneralWhy am i getting this error and how to solve it? Thanks. Pin
shapper19-Feb-05 10:07
shapper19-Feb-05 10:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.