Posted by: Dave Rabelink
I am trying to get this small piece of VisualBasic code
to work in TD3.1. I did try it in TD1.5.1 some time ago, but
i could not get it working. So i build the VB application as
a wrapper around the functionality i needed.
Now i ported the CTD1.5.1 application to TD3.1 and would like
to get rid of the VB application and implement it in TD3.1 all the way.
But again i get stuck on 1 line of code which is not 1:1 portable.
So here the VB code to access ActiveX (COM) :
**** VB code for Login on ActiveX server Desk *****
Dim Desk As New GsAgentDesktopInfo
Dim DeskConn As IGsConnectionInfo
Set DeskConn = Desk
DeskConn.Host = "HostName"
DeskConn.Port = "PortName"
Desk.Login
***********************************************
This works in VB perfectly. This actually does Desk.Login OK.
(There is more after this code, but not interesting for this problem).
I generate the ActiveX library in TD3.1 and all the classes show up.
Here the TD3.1 code :
If Desk.Create( )
Set DeskConn = uDesk
If DeskConn.PropSetHost( "HostName" )
If DeskConn.PropSetPort( "PortName" )
If Desk.Login( )
I get a "Assignent of different types" when compiling on the second line
(Set DeskConn = uDesk) !
I know the Set command is invalid. The Desk and DeskConn objects are not
from the same class and also no inheritance is present.
There is no method on Desk to get the DeskConn.
First, what does the "Set DeskConn = Desk" in VB do ?
Does it assign the pointer to Desk to DeskConn ?
Is there an equivalent in TD to assign COM objects like in VB ?
I tried this, but none of them works :
If DeskConn.Attach( Desk ) > returns FALSE
If Desk.GetInterface( DeskConn, IID_GsCfgInf_IGsAgentDesktopInfo ) > returns
TRUE, but methods of DeskConn do not work (automation error)
If Desk.GetInterface( DeskConn, IID_GsCfgInf_IGsConnectionInfo ) > returns
FALSE
So i'm stuck. I do not know how to translate "Set DeskConn = Desk" from VB
to TD !!!
Please help so i can uninstall VB from my workstation :wink:
Dave