Invoking Ole Properties Dialog from the container
achyuth -- achyuth@geocities.com
Wednesday, March 05, 1997
Hi,
Environment: VC++ 4.2b, Win 95
I have an OCX control. I need to launch the properties of the control
(COlePropertySheet) from the 'Test Container' application on left button
double click on the control. What function I need to call in
'::OnLButtonDblClick' overriden function in the control 'cpp'?
achyuth
Mihael Iordanov -- mihael@dra.com
Thursday, March 06, 1997
[Mini-digest: 4 responses]
// ssume you have your ocx already created - let's call it ocx
// get the IUnknown for the OCX
LPUNKNOWN pIUknown = ocx.GetControlUnknown();
ASSERT( pIUknown );
// get IOleObject for the control
LPOLEOBJECT lpObject = NULL;
HRESULT hr = pIUknown->QueryInterface( IID_IOleObject, ( LPVOID* )
&lpObject );
if( SUCCEEDED( hr ) )
{
// This is an OLE control.
// invoke the property pages
HRESULT hRezult = lpObject->DoVerb( AFX_IDS_VERB_PROPERTIES, NULL,
NULL, 0, this->m_hWnd, NULL );
}
Mihael Iordanov
----------
From: achyuth[SMTP:achyuth@geocities.com]
Sent: Wednesday, March 05, 1997 10:11 AM
To: mfc-l@netcom.com
Subject: Invoking Ole Properties Dialog from the container
Hi,
Environment: VC++ 4.2b, Win 95
I have an OCX control. I need to launch the properties of the control
(COlePropertySheet) from the 'Test Container' application on left button
double click on the control. What function I need to call in
'::OnLButtonDblClick' overriden function in the control 'cpp'?
achyuth
-----From: hou@tfn.com (Bing Hou)
COleControl::OnProperties(...).
Bing Hou
hou@tfn.com
------------------------------------------------------------------------
"The saints are the sinners who keep on trying."
______________________________ Reply Separator _________________________________
Subject: Invoking Ole Properties Dialog from the container
Author: achyuth at Internet
Date: 3/5/97 3:41 PM
Hi,
Environment: VC++ 4.2b, Win 95
I have an OCX control. I need to launch the properties of the control
(COlePropertySheet) from the 'Test Container' application on left button
double click on the control. What function I need to call in
'::OnLButtonDblClick' overriden function in the control 'cpp'?
achyuth
-----From: jeremy@omsys.com (Jeremy H. Griffith)
On Wed, 05 Mar 1997 15:41:39 +0530, achyuth wrote:
>Environment: VC++ 4.2b, Win 95
>I have an OCX control. I need to launch the properties of the control
>(COlePropertySheet) from the 'Test Container' application on left button
>double click on the control. What function I need to call in
>'::OnLButtonDblClick' overriden function in the control 'cpp'?
I use this in VC++ 4.0, WinNT 3.51 SP5; it should work for you too:
void MyOleCtl::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CWnd* pWnd = GetParent();
if (!pWnd)
return;
HWND hParent = pWnd->GetSafeHwnd();
if (!hParent)
return;
OnProperties(NULL, hParent, NULL);
Refresh();
}
--Jeremy
Jeremy H. Griffith * jeremy@omsys.com * Voice: 802-297-0154
http://www.omsys.com * Snail: PO Box 551, Bondville, VT 05340
-----From: Mike Blaszczak
At 15:41 3/5/97 +0530, achyuth wrote:
>Environment: VC++ 4.2b, Win 95
>I have an OCX control. I need to launch the properties of the control
>(COlePropertySheet) from the 'Test Container' application on left button
>double click on the control.
According to page 764 of my book, give a pointer to a COleControl at
pWnd, you could write code like this:
LPUNKNOWN lpUnknown = pWnd->GetControlUnknown();
LPOLEOBJECT lpOleObject;
if (SUCCEEDED(lpUnknown->QueryInterface(IID_IOleObject,
(void**) &lpOleObject))
{
CRect rect;
GetWindwoRect(rect);
lpObject->DoVerb(OLEIVERB_PROPERTIES, NULL, NULL, 0, m_hWnd, rect);
lpObject->Release();
}
and that's it.
>What function I need to call in
>'::OnLButtonDblClick' overriden function in the control 'cpp'?
Your question is now unclear to me. Do you want to show the property pages
from code within your control, or from within your container?
.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.
Become an MFC-L member
| Вернуться в корень Архива
|