Click here to Skip to main content
15,908,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem when inserting items in CListCtrl Icon view Pin
Naveen13-Jan-06 22:11
Naveen13-Jan-06 22:11 
Questiontemplate Visual Studio 6 to Visual Studio .NET Pin
patgo13-Jan-06 0:54
patgo13-Jan-06 0:54 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
toxcct13-Jan-06 1:07
toxcct13-Jan-06 1:07 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
Rajesh R Subramanian13-Jan-06 1:16
professionalRajesh R Subramanian13-Jan-06 1:16 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
patgo13-Jan-06 1:17
patgo13-Jan-06 1:17 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
Stephen Hewitt14-Jan-06 14:50
Stephen Hewitt14-Jan-06 14:50 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
patgo15-Jan-06 22:16
patgo15-Jan-06 22:16 
GeneralRe: template Visual Studio 6 to Visual Studio .NET Pin
Stephen Hewitt15-Jan-06 22:44
Stephen Hewitt15-Jan-06 22:44 
QuestionAny module to encode and decode from bufferarray with a short time ? Pin
James Duy Trinh (VietDoor)13-Jan-06 0:37
James Duy Trinh (VietDoor)13-Jan-06 0:37 
QuestionCListCtrl: Automatic Scroll- Down Pin
romuzu13-Jan-06 0:27
romuzu13-Jan-06 0:27 
AnswerRe: CListCtrl: Automatic Scroll- Down Pin
Rajesh R Subramanian13-Jan-06 0:37
professionalRajesh R Subramanian13-Jan-06 0:37 
AnswerRe: CListCtrl: Automatic Scroll- Down Pin
khan++13-Jan-06 1:35
khan++13-Jan-06 1:35 
GeneralRe: CListCtrl: Automatic Scroll- Down Pin
Rajesh R Subramanian13-Jan-06 1:48
professionalRajesh R Subramanian13-Jan-06 1:48 
QuestionCan i pass MFC Objects in between thread ? Pin
vikas amin12-Jan-06 23:20
vikas amin12-Jan-06 23:20 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Owner drawn12-Jan-06 23:31
Owner drawn12-Jan-06 23:31 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Stephen Hewitt12-Jan-06 23:41
Stephen Hewitt12-Jan-06 23:41 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Roger Stoltz12-Jan-06 23:45
Roger Stoltz12-Jan-06 23:45 
It depends on what you mean by "pass" MFC objects and what kind of MFC objects you are "passing".

For instance you should never access any GUI objects from a worker thread to prevent a deadlock situation. Read this[^] if you want to know more. This article is also great to know about thread handling.
In the article forum that belongs to the article there is also a discussion regarding your original question.

I know that CAsyncSocket has some issues when being accessed from different threads, but I can't remember them at the top of my head.

Creating MFC objects, such as CString objects, on the heap and "pass" them to another thread using ::PostMessage is always save provided that you forget about the object in the thread that created the object setting the pointer to NULL and you only have one receiving thread.

You could also use some container class, such as std::queue, to "pass" objects from one thread to another. But then you have to provide synchronization with mutual exclusions such as CRITICAL_SECTION to prevent two threads accessing the same object simultaniously. You simply "lock" the container when accessing objects in the container and "unlock" the container when you're done.

Hope this helps
--
Roger


It's supposed to be hard, otherwise anybody could do it!

-- modified at 6:11 Friday 13th January, 2006 Added hint about article forum discussion.
AnswerRe: Can i pass MFC Objects in between thread ? Pin
Prakash Nadar12-Jan-06 23:45
Prakash Nadar12-Jan-06 23:45 
AnswerRe: Can i pass MFC Objects in between thread ? Pin
ThatsAlok15-Jan-06 18:19
ThatsAlok15-Jan-06 18:19 
AnswerThank you everyone Pin
vikas amin16-Jan-06 1:10
vikas amin16-Jan-06 1:10 
Questionwprintf() could not display unicode chars which is > 255 to console? Pin
wangdave12-Jan-06 23:11
wangdave12-Jan-06 23:11 
QuestionHow to block a window ? Pin
leenmie12-Jan-06 22:50
leenmie12-Jan-06 22:50 
AnswerRe: How to block a window ? Pin
Stephen Hewitt12-Jan-06 23:49
Stephen Hewitt12-Jan-06 23:49 
AnswerRe: How to block a window ? Pin
Roger Stoltz13-Jan-06 0:00
Roger Stoltz13-Jan-06 0:00 
GeneralRe: How to block a window ? Pin
Stephen Hewitt13-Jan-06 0:14
Stephen Hewitt13-Jan-06 0:14 

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.