Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Using CAtlArray for a class member variable

, 6 Oct 2012
[ bappycse05] is correct but I also used a Thread which is a member function of a class and wanted it to access the class's member variables, but the moment the thread ends, any changes it makes in any member variables are erased.

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

6 Oct 2012
Briti Sundar
May be you have missed to malloc first before insert into MyArray.MyDataStructure* pNewStruct;pNewStruct =(MyDataStructure* )malloc(sizeof(MyDataStructure));MyArray.Add(pNewStruct);Hope this will work.
8 Oct 2012
Briti Sundar
This work for me and i get value after thread exit. Compare your code with me , you can understand your problem. Another thing CreateThread can not call a member function, so you must need a static function for this.,#include "stdafx.h"#include #include #include #include class...
6 Oct 2012
Michael N. Haephrati
7 alternatives  
I would appreciate it if someone can provide me with a code sample for using CAtlArray as a member variable inside a class, where the array should hold a custom data structure.I have defined the data structure:typedef struct{ int Status; CTime StatusDate;}...
9 Oct 2012
Michael N. Haephrati
How can I get notified, to the main even loop when this thread completes?
8 Oct 2012
Michael N. Haephrati
Something like// testproject.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include typedef struct{ CString FullPath; CTime StatusDate;} Item;class MyClass{public: MyClass(); ~MyClass(); void...
8 Oct 2012
Briti Sundar
It will be better if you post a little bit of code. However,suppose classname is MyClass and your thread name MyThread. You call this thread from your class. then try this.._beginthread(MyThread,0,this);void* MyThread(void* arg){ MyClass* newObj = (MyClass* )arg; // now...
9 Oct 2012
Briti Sundar
Use this ---dwRet = WaitForSingleObject(HANDLE,TIME);see the example .. http://www.installsetupconfig.com/win32programming/threadprocesssynchronizationapis11_13.html[^]when thread will be completed, use postmessage method to inform UI :D

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Michael N. Haephrati
CEO
United States United States
Michael Haephrati, is an entrepreneur, inventor and a musician. Haephrati worked on many ventures starting from HarmonySoft, designing Rashumon, the first Graphical Multi-lingual word processor for Amiga computer. During 1995-1996 he worked as a Contractor with Apple at Cupertino. Worked at a research institute made the fist steps developing the credit scoring field in Israel. He founded Target Scoring and developed a credit scoring system named ThiS, based on geographical statistical data, participating VISA CAL, Isracard, Bank Leumi and Bank Discount (Target Scoring, being the VP Business Development of a large Israeli institute).

During 2000, he founded Target Eye, and developed the first remote PC surveillance and monitoring system, named Target Eye.

Other ventures included: Data Cleansing (as part of the DataTune system which was implemented in many organizations.


Follow on   Twitter   Google+   LinkedIn

| | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 7 Oct 2012
Article Copyright 2012 by Michael N. Haephrati
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid