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

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


OCX Containment Question

Ed Kaltenbach -- kaltenba@ataway.aptec.com
Friday, January 26, 1996

Hello All,

I am using Visual C++ 4.0 on Windows 95.

I am implementing a view where the user will be able
to "build" displays by selecting from several controls
and dropping them into a view (similar to dialog editor).
The controls will be things like bar graphs, thermometers,
scope plots, voltmeters, etc.
This way the software stays generic and the users can
build data display views that are appropriate for his/her
experiment.

I would like to make the code smart enough so that other OCXs
(written, downloaded, or purchased) could be added to the
interface with minimal effort by the user.

I seems like I could get a list of registered OCXs,  build a
palette dynamically,  and allow the user to select which properties
or methods need to be called to update the control with data.
The property pages for each OCX would allow the user to set other
properties.

I have searched through a lot of documentation but I cannot find
any examples.

Is it unreasonable to attempt this?
Does anybody know of a tutorial or sample code that does this?

Thanks,
Ed

P.S. I have been able to use CWnd:CreateControl to put registered
     OCXs on a MDI view.  I don't how to get an Object that can send
     verbs to the OCX to bring up the Properties Pages.





John & Annette Elsbree -- elsbree@msn.com
Sunday, January 28, 1996

Ed -

From: 	owner-mfc-l@netcom.com on behalf of Ed Kaltenbach
>...
> I seems like I could get a list of registered OCXs,  build a
> palette dynamically,  and allow the user to select which properties
> or methods need to be called to update the control with data.
> The property pages for each OCX would allow the user to set other
> properties.
>
> I have searched through a lot of documentation but I cannot find
> any examples.
>
> Is it unreasonable to attempt this?

I'd say go ahead and try. The lack of samples doesn't necessarily mean it's an 
unreasonable thing to attempt. You'll probably need to override some of MFC's 
default code for handling events fired by the OLE controls, since 
EVENTSINK_MAPs are typically compile-time constant data, but in your case they 
can't be.

>...
> P.S. I have been able to use CWnd:CreateControl to put registered
>      OCXs on a MDI view.  I don't how to get an Object that can send
>      verbs to the OCX to bring up the Properties Pages.

Use CWnd::GetControlUnknown, then IUnknown::QueryInterface to get an 
IOleObject pointer.

mfcTeam.m_johnels;	// does not represent Microsoft




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