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.
# 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...
# 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...
# 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