COM Activex [examples]

 

The code below will embed Internet Explorer into a Form. You can embed COM/ActiveX controls in any of the containers in the Lianja App Framework e.g. Form, Container, Control, or Page (Tab Page).

myform = createobject("form")
myform.resize(800, 600)
myform.addobject("ax", "{8856F961-340A-11D0-A96B-00C04FD705A2}")
ax.anchor = 15
ax.navigate("http://www.lianja.com")
myform.show()

Creating the COM/ActiveX component

You can specify the ActiveX control in several different formats.

The most efficient way is by using the registered component’s UUID, e.g.

createObject("{8E27C92B-1264-101C-8A2F-040224009C02}")

The second fastest way is to use the registered control’s class name (with or without version number), e.g.

createObject("MSCal.Calendar")

The slowest, but easiest way to use is to use the control’s full name, e.g.

createObject("Calendar Control 9.0")

It is also possible to initialize the object from a file, e.g.

createObject("c:/files/file.doc")

If the component’s UUID is used the following patterns can be used to initialize the control on a remote machine, to initialize a licensed control or to connect to a running object:

To initialize the control on a different machine use the following pattern:

createObject("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}")

To initialize a licensed control use the following pattern:

createObject("{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey")

To connect to an already running object use the following pattern:

createObject("{8E27C92B-1264-101C-8A2F-040224009C02}&")

The first two patterns can be combined, e.g. to initialize a licensed control on a remote machine:

createObject("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey")

Binding to events

Binding to events that are emitted from a COM/ActiveX component is simple. See below.

define class myeventhandler
    // handle the events you are interested in
    proc DownloadBegin()
    endproc

    proc DownloadComplete()
    endproc

    proc ProgressChange(currentvalue, maxvalue)
    endproc

    // The "Special" HandleEvent method can be used to trace events but be sure to remove it in production systems 
    // as it incurs unnecessary performance overhead
    proc HandleEvent(name, arglist)
    endproc
endclass

ie = createObject("{8856F961-340A-11D0-A96B-00C04FD705A2}")
myhandler = createObject("myeventhandler")
eventHandler(ie, myhandler)

https://www.lianja.com/doc/index.php/Using_COM/ActiveX_in_Lianja_on_Windows


 

COM DLL

Q:

Can you use the Fox Pro libraries to compress files in Lianja?

A:

we use the Chilkat libraries for a number of purposes in VFP and Lianja. The integration with Lianja is particularly smooth (and described well on the Lianja site). The Zip options available are very handy in various scenarios.

A2:

The chilkat extension for Lianja is available for Windows, Linux and MacOS.
https://www.chilkatsoft.com/

There are many feature rich classes specifically built for Lianja including zip/unzip and other compression libraries.
https://www.chilkatsoft.com/refdoc/lianjaZipRef.html


 

 

COM & DLL

Q:
We need to call a number of 3rd party 32 bit Windows DLLs from Lianja.
Is this easy to do?
A:
It depends on what sort of DLLs they are, standard native DLLs or managed .net DLLs. These are different altogether.
If the DLLs contain standard C functions (not .net) you should be able to use DECLARE DLL.
If these are .net managed DLLs you need to write a set of wrapper classes or functions using the Lianja C/C++ API that instantiates the .net runtime and proxies the calls passing parameters in and out.