Welcome! Log In Create A New Profile

Advanced

Dynamically load activex at runtime

Posted by David.pcs.crosspost 
David.pcs.crosspost
Dynamically load activex at runtime
August 21, 2008 11:42AM
Hi forum, i would like to load an activex into a activex control at runtime, i've been looking in the forums and came up with nothing. Is there a way to do it?

By the way i'm still using WD10 and hoping for WD12...

Thanks in advance.

Message forwarded from pcsoft.us.windev
JA-PSI.pcs.crosspost
Re: Dynamically load activex at runtime
August 21, 2008 05:35PM
David a écrit :
> Hi forum, i would like to load an activex into a activex control at runtime, i've been looking in the forums and came up with nothing. Is there a way to do it?
>
> By the way i'm still using WD10 and hoping for WD12...
>
> Thanks in advance.

It is quite easy:
AX_ActiveX1..Value="WMPlayer.OCX"
AX_ActiveX1..Value="QTOControl.QTControl"

Regards
/JA
[www.ja-psi.com]
Message forwarded from pcsoft.us.windev
David.pcs.crosspost
Re: Dynamically load activex at runtime
August 22, 2008 12:02PM
Thanks for your answer,
i'd already tried that but it didn't work, i guess...
When directly assigning the activex to the activex control:
activexControl[..value] = "activex.ocx"
it doesn't allow accessing the public methods of the activex.
activexControl>>Method()

I also tried using
{activexControl}>>Method()
and it didn't work also, so i concluded that the activex wasn't loaded.

Is any other way to loaded it or to access its methods?

I hope this message isn't repeated since i've post a reply yesterday but it didn't showed up.

Message forwarded from pcsoft.us.windev
Alexander Predl.pcs.crosspost
Re: Dynamically load activex at runtime
August 22, 2008 02:27PM
hmmm, not quite easy...

with ole objects you can:
oPosPrinter1 is object OLE "OPOS.POSPrinter"
then access the values with:
trace(oPosPrinter1>>Value) or
oPosPrinter1>>Print()

second way:
objTest is object OLE dynamic = ActiveX1 //The Control must be loaded at
//Designtime, but the ActiveX, is
//not active and can be missig....
trace(objTest>>Value)
objTest>>Print()

Third:
objExcel is object Automation dynamic
objExcel = new object Automation "Excel.Application"
trace(objExcel>>visible)
objExcel>>workbooks>>Add

Quite tricky with ActiveX, but maybe it works for you, please try.

yours
Alexander Predl

Message forwarded from pcsoft.us.windev
David.pcs.crosspost
Re: Dynamically load activex at runtime
August 22, 2008 04:49PM
Thanks Alexander i've tried your first method and it worked with the exception it couldn't get the events triggered by the activex.

The second method was little more tricky and i couldn't get it to work.

But the first method gave me an idea, since the activex is registered in the system instead assigning it to the disk file (activex.ocx) i used its register name (activex.form) and it worked just fine. Now i can access its methods and the events triggered by it - daahhh.

Solved



Message forwarded from pcsoft.us.windev
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: