Alternatives
Members may post updates or alternatives to this current article in order to show different
approaches or add new features.
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.
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 2012Michael 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 2012Michael Haephrati
How can I get notified, to the main even loop when this thread completes?
8 Oct 2012Michael 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...
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...
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
Michael Haephrati is a music composer, an inventor and an expert specializes in software development and information security, who has built a unique perspective which combines technology and the end user experience. He is the author of a
the book Learning C++ , which teaches C++ 20, and was published in August 2022.
He is the CEO of
Secured Globe, Inc., and also active at
Stack Overflow.
Read our
Corporate blog or read my
Personal blog.