Accessing to MFC object through a Thread

Hi there

My Question is :

How can i access to a CDialog (MFC Object) within a Thread created with Win32 CreateThread. i know that this is not allowed because of The CHandleMap. so who can i do it.

- i tried to pass the HWND handle to the thread and then inside the thread i'll create my a CDialog object corresponding to that HWND via Attach(HWND).
this worked but no control is displayed in the dialog and my application blocks.

if you have any suggestion, link , ... just post it.

Thank you.
[555 byte] By [HollyMatrix] at [2007-11-20 1:11:51]
# 1 Re: Accessing to MFC object through a Thread
Take a look at the following FAQ ( http://www.dev-archive.com/forum/showthread.php?t=312454). It is MFC based, however, the technique is unique...
Andreas Masur at 2007-11-9 13:59:05 >
# 2 Re: Accessing to MFC object through a Thread
Thank you for this link.

i wanted to avoid the using of SendMessage/PostMessage. but i think this is impossible.

thank you.
HollyMatrix at 2007-11-9 14:00:05 >
# 3 Re: Accessing to MFC object through a Thread
Well...is there any specific reason why you want to avoid messages? Windows is based on the event approach using messages...
Andreas Masur at 2007-11-9 14:01:04 >
# 4 Re: Accessing to MFC object through a Thread
yes windows is based on Messages, but i'am trying to use Vritual function. so my dll can interact with non Windows Application.


i use virtual function like OnEvent....() that must be implemented in the drived class (by the user of my Dll) to process the event.

but now i implemented the two methods (Virtual and Win Event). so if i give a HWND to my class it will use the Window messages else toggle to the Virtual function.

that's all

Thank you
HollyMatrix at 2007-11-9 14:02:09 >