Control Container OCX and child OCX housed in one DLL
Michael R Thompson -- mike@tracker.com.au
Wednesday, March 05, 1997
Environment: VC++ 4.2b, Win NT 4.0
I have a suite of OCX's which I have put into one DLL to conserve =
memory. One of my OCX's is also a container for one of the other OCX's =
in the DLL. Everything works fine when the two OCX's are in separate =
DLL's. However, when they are combined I get an ASSERT when the =
container OCX attempts to create the child OCX. MFC is complaining about =
a windows handle being attached to more than one CWnd object. The child =
OCX creates its own CWnd fine. However, when the OleControlSite tries to =
attach the same HWND to its own CWnd object, MFC complains. When the =
OCX's are in separate DLL's, MFC maintains separate CWnd <--> HWND maps =
so there is no problem. When the two OCX's are combined there is only =
one HWND map, hence MFC asserts in CWnd::Attach when it finds the HWND =
already in its map.
The simple solution to this is two keep the two OCX's separate. Does =
anybody know of a real solution to this problem?
Mihael Iordanov -- mihael@dra.com
Friday, March 07, 1997
[Mini-digest: 3 responses]
I'm not sure this would solve your problem, since I don't know the
exact assertion. However, I got rid of a similar problem calling
AfxEnableControlContainer() in InitInstance() of the OCX that is a
container.
Mihael Iordanov
----------
From: Michael R Thompson[SMTP:mike@tracker.com.au]
Sent: Wednesday, March 05, 1997 8:30 AM
To: MFC Mailing List (E-mail)
Subject: Control Container OCX and child OCX housed in one DLL
Environment: VC++ 4.2b, Win NT 4.0
I have a suite of OCX's which I have put into one DLL to conserve
memory. One of my OCX's is also a container for one of the other OCX's
in the DLL. Everything works fine when the two OCX's are in separate
DLL's. However, when they are combined I get an ASSERT when the
container OCX attempts to create the child OCX. MFC is complaining
about a windows handle being attached to more than one CWnd object.
The child OCX creates its own CWnd fine. However, when the
OleControlSite tries to attach the same HWND to its own CWnd object,
MFC complains. When the OCX's are in separate DLL's, MFC maintains
separate CWnd <--> HWND maps so there is no problem. When the two
OCX's are combined there is only one HWND map, hence MFC asserts in
CWnd::Attach when it finds the HWND already in its map.
The simple solution to this is two keep the two OCX's separate. Does
anybody know of a real solution to this problem?
-----From: Mike Blaszczak
At 18:30 3/5/97 +1000, Michael R Thompson wrote:
>Environment: VC++ 4.2b, Win NT 4.0
> [...]
> However, when the OleControlSite tries to attach the same HWND
> to its own CWnd object, MFC complains. [...]
>The simple solution to this is two keep the two OCX's separate.
> Does anybody know of a real solution to this problem?
You could argue that this is a bug in MFC, but putting the controls
into different DLLs is, for now, the real answer.
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
This performance was not lip-synched.
-----From: Michael R Thompson
Environment: VC++ 4.2b, Win NT 4.0
I have a suite of OCX's which I have put into one DLL to conserve =
memory. One of my OCX's is also a container for one of the other OCX's =
in the DLL. Everything works fine when the two OCX's are in separate =
DLL's. However, when they are combined I get an ASSERT when the =
container OCX attempts to create the child OCX. MFC is complaining about =
a windows handle being attached to more than one CWnd object. The child =
OCX creates its own CWnd fine. However, when the OleControlSite tries to =
attach the same HWND to its own CWnd object, MFC complains. When the =
OCX's are in separate DLL's, MFC maintains separate CWnd <--> HWND maps =
so there is no problem. When the two OCX's are combined there is only =
one HWND map, hence MFC asserts in CWnd::Attach when it finds the HWND =
already in its map.
The simple solution to this is two keep the two OCX's separate. Does =
anybody know of a real solution to this problem?
Become an MFC-L member
| Вернуться в корень Архива
|