G
Guest
Hi all,
We have a property sheet that is created in one dll, and on that property
sheet, there is a property page that is created in another dll. So, the
property sheet and the property page come from different module states. Now,
in CPropertySheet::OnKickIdle(), it calls GetActivePage(), which then sends a
message in order to get the handle to the active page. Given the handle, it
then calls CWnd::FromHandle() to get the pointer to the CPropertyPage. The
problem is that the CPropertyPage was initialized in a different module state
than the CPropertySheet, and so the map of handles-to-pointers does not
include the property page. Since the handle is not found in the map, MFC
creates a temporary CWnd object and gives us that back. But this object isn't
a CPropertyPage, and so GetActivePage() fails. I can think of three
possibilities here...
(1) Creating a page in one dll and adding it to a sheet in another dll is
not legal/supported, and so we shouldn't even try to do it,
(2) The code in CPropertySheet should not do a FromHandle() because that is
assuming that we are in the correct module state for the active page,
(3) There is something else we have to do to make this work.
We have a property sheet that is created in one dll, and on that property
sheet, there is a property page that is created in another dll. So, the
property sheet and the property page come from different module states. Now,
in CPropertySheet::OnKickIdle(), it calls GetActivePage(), which then sends a
message in order to get the handle to the active page. Given the handle, it
then calls CWnd::FromHandle() to get the pointer to the CPropertyPage. The
problem is that the CPropertyPage was initialized in a different module state
than the CPropertySheet, and so the map of handles-to-pointers does not
include the property page. Since the handle is not found in the map, MFC
creates a temporary CWnd object and gives us that back. But this object isn't
a CPropertyPage, and so GetActivePage() fails. I can think of three
possibilities here...
(1) Creating a page in one dll and adding it to a sheet in another dll is
not legal/supported, and so we shouldn't even try to do it,
(2) The code in CPropertySheet should not do a FromHandle() because that is
assuming that we are in the correct module state for the active page,
(3) There is something else we have to do to make this work.