How to Convert a Native PM Item to OCL
Most native PM windows have an equivalent in OCL, and an item that already
exists on a window can at any time be "converted" to OCL. This is
advantageous for example if some of the functionality you need has already
been implemented using OCL. For example:
> Can a pointer to a 'low-level' listbox be converted into a pointer to an
> Open Class listbox?
Dave Briccetti (daveb@davebsoft.com) says:
Most of the OC UI controls have a constructor that takes the HWND of an
existing control. In this case, the constructor looks like
IListBox (const IWindowHandle &)
IWindowHandle is an "alias" for HWND.
Bill Law (law@netscape.com) also adds the following:
Perhaps you should add that if an OCL window already exists for a given HWND,
then constructing another one from its HWND will result in an exception being
thrown. Generally, if there is a chance that an existing OCL window exists
(or you know that one does and you just want to locate it), then you can use
IWindow::fromHandle to get the existing IWindow (or derived-class) object. If
that returns 0, then you can safely construct another IWindow
(or derived-class) object.
Page generated by Stéphane Charette on 1997 November 02
Open Class Library (OCL) FAQ © Stéphane Charette, 1997