Click here to Skip to main content
16,006,474 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralScrolling a CListBox. Pin
John Uhlenbrock5-Oct-01 12:02
John Uhlenbrock5-Oct-01 12:02 
GeneralMultiple Splitters in WTL Pin
Leo Smith5-Oct-01 11:22
Leo Smith5-Oct-01 11:22 
QuestionHas anybody programmed SNMP? Pin
Kelly Herald5-Oct-01 10:57
Kelly Herald5-Oct-01 10:57 
AnswerRe: Has anybody programmed SNMP? Pin
Masaaki Onishi5-Oct-01 15:21
Masaaki Onishi5-Oct-01 15:21 
QuestionHow can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
youssef5-Oct-01 10:23
youssef5-Oct-01 10:23 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus5-Oct-01 10:59
protectorChristian Graus5-Oct-01 10:59 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Paolo Messina5-Oct-01 11:01
professionalPaolo Messina5-Oct-01 11:01 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Leo Smith5-Oct-01 11:05
Leo Smith5-Oct-01 11:05 
If I understand your question correctly, what I do is convert the struct into a class and have it inherit CObject as public. Once I do this, if I want the structure to be able to assign the values directly, I make all the values public. Then I make empty constuctor and destructor (unless you want to assign some default values). Then I will use CObArray. With this I can do everything I would do with CByteArray, but with typecasting:

CMyStruct *p = (CMyStruct *) m_array.GetAt(x);

If you wanted to do this cleaner (without the typecasting), you can create a new array class and have it do the typecasting for you, but I don't do this unless someone else will have to maintian the code.

class CMyStruct : public CObject
{
public:
int Val1;
int Val2;
CString Text1;

CMyStruct() {;}
~CMyStruct() {;}
};

I hope this helps.


Leo T. Smith
Senior Programmer/Analyst
Hartwick College
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir5-Oct-01 11:27
Fazlul Kabir5-Oct-01 11:27 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus5-Oct-01 16:53
protectorChristian Graus5-Oct-01 16:53 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir6-Oct-01 11:28
Fazlul Kabir6-Oct-01 11:28 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus6-Oct-01 11:51
protectorChristian Graus6-Oct-01 11:51 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir6-Oct-01 18:06
Fazlul Kabir6-Oct-01 18:06 
GeneralCListView with a Timer Pin
daniel995-Oct-01 10:14
daniel995-Oct-01 10:14 
GeneralRe: CListView with a Timer Pin
Andres Manggini5-Oct-01 10:43
Andres Manggini5-Oct-01 10:43 
QuestionHow do I use CButton::Create() to make a push button check box? Pin
Bart-Man5-Oct-01 10:12
Bart-Man5-Oct-01 10:12 
AnswerRe: How do I use CButton::Create() to make a push button check box? Pin
Fazlul Kabir5-Oct-01 10:17
Fazlul Kabir5-Oct-01 10:17 
GeneralRe: How do I use CButton::Create() to make a push button check box? Pin
Bart-Man5-Oct-01 10:22
Bart-Man5-Oct-01 10:22 
AnswerFinal Solution Pin
Bart-Man5-Oct-01 10:55
Bart-Man5-Oct-01 10:55 
GeneralConnect() timeout Pin
Alex Griffing5-Oct-01 9:27
Alex Griffing5-Oct-01 9:27 
GeneralOverriding CWndClassInfo in ATL Pin
5-Oct-01 8:05
suss5-Oct-01 8:05 
GeneralDisplay attributes Pin
john john mackey5-Oct-01 7:32
john john mackey5-Oct-01 7:32 
GeneralRe: Display attributes Pin
5-Oct-01 7:36
suss5-Oct-01 7:36 
GeneralDisabling item in CListCtrl Pin
5-Oct-01 7:02
suss5-Oct-01 7:02 
GeneralRe: Disabling item in CListCtrl Pin
Masaaki Onishi5-Oct-01 9:59
Masaaki Onishi5-Oct-01 9:59 

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.