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.
--
Thanks much
Saran 2 2810
Saran wrote: 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.
Is there any chance you can use extension DLLs? I've written many MFC
extension DLLs, and I've never once worried about module state. I do define
resource ranges for each DLL and adhere to them when I create their
resources. You can create a sample MFC EXE project and note where the
various resource IDs begin; your extension DLL ID space then would start
substantially beyond those IDs. To avoid stepping on MFC's ID space, see
these tech notes:
TN020: ID Naming and Numbering Conventions http://msdn.microsoft.com/library/de...OTES_TN020.asp
TN033: DLL Version of MFC http://msdn.microsoft.com/library/de...OTES_TN033.asp
--
Doug Harrison
Microsoft MVP - Visual C++
Hi Doug-
I can't use extension DLLs. I am dealing with large applications which can
be configured differently, and so we have to keep some code in separate
top-level dlls. So, this brings me back to where I started. Either:
(1) Microsoft does not intend CPropertySheets to own CPropertyPages whose
resources come from different module states, or
(2) CPropertySheet should not be calling FromHandle the way it currently is,
or
(3) There is some trick to get this to work...
Thanks
Saran
"Doug Harrison [MVP]" wrote: Saran wrote:
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.
Is there any chance you can use extension DLLs? I've written many MFC extension DLLs, and I've never once worried about module state. I do define resource ranges for each DLL and adhere to them when I create their resources. You can create a sample MFC EXE project and note where the various resource IDs begin; your extension DLL ID space then would start substantially beyond those IDs. To avoid stepping on MFC's ID space, see these tech notes:
TN020: ID Naming and Numbering Conventions http://msdn.microsoft.com/library/de...OTES_TN020.asp
TN033: DLL Version of MFC http://msdn.microsoft.com/library/de...OTES_TN033.asp
-- Doug Harrison Microsoft MVP - Visual C++ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruce Davis |
last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded
tkinter gui application. The problem appears to be a deadlock condition
when a child thread pops up a
Pmw dialog window in...
|
by: Peter Olcott |
last post by:
www.halting-problem.com
|
by: Jon Davis |
last post by:
If I have a class with a virtual method, and a child class that overrides
the virtual method, and then I create an instance of the child class AS A
base class...
BaseClass bc = new ChildClass();...
|
by: Stephen |
last post by:
Hi,
I have created a NON-MODULE CPropertySheet in a form. And I have added
several CPropertyPage to the sheet.
There's a runtime error where I call SetWindowText of CProertyPage which is
not...
|
by: Ammar |
last post by:
Dear All,
I'm facing a small problem.
I have a portal web site, that contains articles, for each article, the end
user can send a comment about the article.
The problem is:
I the comment length...
|
by: Dany |
last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
|
by: Krish |
last post by:
hi all,
In my application I use Cpropertysheet to create tabs....
I am having OK,CANCEL,HELP buttons in that window...
i am not able to move the control over Help button using -> arrow
key...I am...
|
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was...
|
by: asuna |
last post by:
I have a class extends CPropertyPage, I want to add a button in this
page, for jumping to another CPropertyPage.
But how can I get a pointer of CPropertySheet? Then I can use the
SetActivePage()....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |