15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Can you make a OLE Control an OLE Control container?

MikeMike -- MikeMike@athens.emi.net
Tuesday, March 26, 1996

[Moderator's note: In this episode, Mike answers his own question
before it even gets to the list...]

Opps...It turns out the answer to this one is quite obvious (sorry it 
wasn't to me initially so maybe this will help someone else out).

After resolving this I wonder why Microsoft doesn't make OLE Control 
Containment an option when creating OLE Controls in OLEControlWizard?

Anyway, I awoke this morning and the first thing I thought of was that 
OleControlWizard does NOT give you the option of making your OLE Control a 
OLE Control Container.  I wondered if OLE controls are by their nature OLE 
Control containers.  Apparently not!

Therefore in my
COleControlModule::InitInstance
I put
AfxEnableControlContainer()

It works...My OLE Control now allows me to have make OLE control childs.

I hope this is helpful to someone.

----------
From:  MikeMike[SMTP:MikeMike]
Sent:  Sunday, March 26, 1995 4:26 AM
To:  'mfc-l@netcom.com'
Subject:  Can you make a OLE Control an OLE Control container?
Importance:  High

VC4.1 Win95

Hello

The quick question is "Can you make a OLE Control an OLE Control 
container?"

The long drawn out reason and problem I am having is as follows:

I am getting an ASSERT(ContinueModal()) in Wincore.cpp on Line# 3525

BECAUSE I have an OLE Control that creates a DoModal PropertySheet that 
contains in itself contains an OLE Control...as follows

CMyOleControl::OnWhatever()
{
CMyPropertySheet mPS;
	mPS.DoModal();
}

the ASSERT(ContinueModal()) I get is in Wincore.cpp on Line #3525

// A quick snippet of Wincore.cpp where the assert happens

int CWnd::RunModalLoop(DWORD dwFlags)
{
	ASSERT(::IsWindow(m_hWnd)); // window must be created
	ASSERT(!(m_nFlags & WF_MODALLOOP)); // window must not already be in modal 
state

	// for tracking the idle time state
	BOOL bIdle = TRUE;
	LONG lIdleCount = 0;
	BOOL bShowIdle = (dwFlags & MLF_SHOWONIDLE) && !(GetStyle() & WS_VISIBLE);
	HWND hWndParent = ::GetParent(m_hWnd);
	m_nFlags |= (WF_MODALLOOP|WF_CONTINUEMODAL);
	MSG* pMsg = &AfxGetThread()->m_msgCur;

	// acquire and dispatch messages until the modal state is done
	for (;;)
	{
		ASSERT(ContinueModal());  <<<--- This is the Line I get the Assert on
	etc
etc
etc

The obvious "assumption" is that an OLE control can not be embedded in a 
property page if the property page is NOT a window descendant of a OLE 
Control CONTAINER.  (Oh and by the way yes the OLE Control is actually a 
child of a OLE Control container.)

Why?  Because if I take this same CMyPropertySheet and call it from a 
non-Ole Control...everything works fine/

So what was the original the question you ask?  Can you make a OLE Control 
an OLE Control container?

Thanx and Your assistance is appreciated
MIKEMIKE@EMI.NET
407-626-2330







Mark Kramer -- markkra@microsoft.com
Friday, March 29, 1996

The code for containment was added to the CWnd class. This means that
any 
window is a candidate for housing an OLE Control. 
>From the desk of ...
     Mark Kramer
(These opinions do not represent Microsoft Corporation)
>----------
>From: 	MikeMike[SMTP:MikeMike@athens.emi.net]
>Sent: 	Tuesday, March 26, 1996 9:58 AM
>To: 	'mfc-l@netcom.com'
>Subject: 	RE: Can you make a OLE Control an OLE Control container?
>
>[Moderator's note: In this episode, Mike answers his own question
>before it even gets to the list...]
>
>Opps...It turns out the answer to this one is quite obvious (sorry it 
>wasn't to me initially so maybe this will help someone else out).
>
>After resolving this I wonder why Microsoft doesn't make OLE Control 
>Containment an option when creating OLE Controls in OLEControlWizard?
>
>Anyway, I awoke this morning and the first thing I thought of was that 
>OleControlWizard does NOT give you the option of making your OLE
>Control a 
>OLE Control Container.  I wondered if OLE controls are by their nature
>OLE 
>Control containers.  Apparently not!
>
>Therefore in my
>COleControlModule::InitInstance
>I put
>AfxEnableControlContainer()
>
>It works...My OLE Control now allows me to have make OLE control
>childs.
>
>I hope this is helpful to someone.
>
>----------
>From:  MikeMike[SMTP:MikeMike]
>Sent:  Sunday, March 26, 1995 4:26 AM
>To:  'mfc-l@netcom.com'
>Subject:  Can you make a OLE Control an OLE Control container?
>Importance:  High
>
>VC4.1 Win95
>
>Hello
>
>The quick question is "Can you make a OLE Control an OLE Control 
>container?"
>
>The long drawn out reason and problem I am having is as follows:
>
>I am getting an ASSERT(ContinueModal()) in Wincore.cpp on Line# 3525
>
>BECAUSE I have an OLE Control that creates a DoModal PropertySheet that
>
>contains in itself contains an OLE Control...as follows
>
>CMyOleControl::OnWhatever()
>{
>CMyPropertySheet mPS;
>	mPS.DoModal();
>}
>
>the ASSERT(ContinueModal()) I get is in Wincore.cpp on Line #3525
>
>// A quick snippet of Wincore.cpp where the assert happens
>
>int CWnd::RunModalLoop(DWORD dwFlags)
>{
>	ASSERT(::IsWindow(m_hWnd)); // window must be created
>	ASSERT(!(m_nFlags & WF_MODALLOOP)); // window must not already be in
>modal 
>state
>
>	// for tracking the idle time state
>	BOOL bIdle = TRUE;
>	LONG lIdleCount = 0;
>	BOOL bShowIdle = (dwFlags & MLF_SHOWONIDLE) && !(GetStyle() &
>WS_VISIBLE);
>	HWND hWndParent = ::GetParent(m_hWnd);
>	m_nFlags |= (WF_MODALLOOP|WF_CONTINUEMODAL);
>	MSG* pMsg = &AfxGetThread()->m_msgCur;
>
>	// acquire and dispatch messages until the modal state is done
>	for (;;)
>	{
>		ASSERT(ContinueModal());  <<<--- This is the Line I get the Assert on
>	etc
>etc
>etc
>
>The obvious "assumption" is that an OLE control can not be embedded in
>a 
>property page if the property page is NOT a window descendant of a OLE 
>Control CONTAINER.  (Oh and by the way yes the OLE Control is actually
>a 
>child of a OLE Control container.)
>
>Why?  Because if I take this same CMyPropertySheet and call it from a 
>non-Ole Control...everything works fine/
>
>So what was the original the question you ask?  Can you make a OLE
>Control 
>an OLE Control container?
>
>Thanx and Your assistance is appreciated
>MIKEMIKE@EMI.NET
>407-626-2330
>
>
>
>
>




| Вернуться в корень Архива |