IupOleControl

IUP - Portable User Interface

IupOleControl

The IupOleControl hosts an windows OLE control (also named ActiveX control), allowing it to be used inside IUP dialogs. There are many OLE controls available, like calendars, internet browsers, PDF readers etc.

Notice that IupOleControl just takes care of the visualization of the control (size and positioning). It does not deal with properties, methods and events. The application must deal with them using the the COM interfaces offered by the control. Nevertheless, using IupLua together with LuaCOM makes it possible to use OLE controls very easily in Lua, accessing their methods, properties and events similarly to the other IUP elements.

Notice that this control works only on Windows, using Visual C++ or Borland C++.

Initialization and usage

The IupOleControlOpen function must be called after a IupOpen, so that the control can be used. The iupole.h file must also be included in the source code. The program must be linked to the controls library (iupole).

To make the control available in Lua, use the initialization function in C, iupolelua_open, after calling iuplua_open. The iupluaole.h file must also be included in the source code. The program must be linked to the lua control library (iupluaole).

Creation

Ihandle* IupOleControl(char* ProgID); [in C]
iup.olecontrol{ProgID: string} -> (elem: ihandle) [in Lua]

ProgID

: the programmatic identifier of the OLE control. This can be found in the documentation of the OLE control or by browsing the list of registered controls, using tools like OleView.

The function returns the OLE control created or NULL if an error occurs.

Attributes

DESIGNMODE: Returns if the control is in design mode. Some controls behave differently when in design mode. See this article for more information about design mode. Default value: "NO".

IUNKNOWN: Returns the IUnknown pointer for the control. This pointer is necessary to access methods and properties of the control in C/C++ code. This is a read-only attribute.

The control's specific attributes shall be accessed using the COM mechanism (see section below for more information).

Callbacks

In C/C++, the OLE control's callbacks (events, in ActiveX terms) shall be set using the control's interface and the COM mechanism. When using IupLua, it's possible to call methods, access properties and receive events from the OLE control using the LuaCOM library. When the LuaCOM library is loaded, for each OLE control created a LuaCOM object is also created and stored in the com field of the object returned by iup.olecontrol. This LuaCOM object can be used to access properties, methods and events in a way very similar to VB. See the examples for more information.

Notes

To learn more about OLE and ActiveX:

http://www.microsoft.com/com http://www.webopedia.com/TERM/A/ActiveX_control.html
http://msdn.microsoft.com/workshop/components/activex/activex_node_entry.asp
http://activex.microsoft.com/activex/activex/

Examples

Browse Example Files

See Also

IupCanvas