Hi.
I just tried to do a syntactical conversion "out of my Memory"... :)
In VB You don´t end the command with a Semicolon, just by a NewLine (VbCrLf).
In VB 'var' is 'Dim', and its Syntax...
And the Functions should return something, thats why you set at the FunctionHeader not only Parameters, also a Return-Type (TypeOf BlaBliBlup)
-> As SomethingToReturn <- If You return a Printf/String you should use 'As String' to set the Type ouf the Return Value.
Howto use the ActiveX I forgot, but basicaly you do Referencing, then storeing into a Variable, and consume the ActiveX Instance.
Performe only on a small numbers of the ActiveX Instance(s).
Alot of Performance and Errros with ActiveX come from Creating always a new ActieX Instance inside Functions/Subs, and then You have to handle that...
Example: If you use only one PDF-ActiveX Instance, You don´t consume too much of Memory if yOu are using the same Document!
Subs in VB are "Functions with no Return Type (Void)".
Function AcquireAdServerProxy() As SomethingToReturn
Dim oSrvConnectionProps = New ActiveXObject("klakaut.KlAkParams")
oSrvConnectionProps.Add("Address", "localhost:13291")
oSrvConnectionProps.Add("UseSSL", true)
Dim oAdmServer = new ActiveXObject("klakaut.KlAkProxy")
oAdmServer.Connect(oSrvConnectionProps)
Return oAdmServer
End Function
Function Update_Host_Comment(hostid As Something,comment As Something) As SomethingToReturn
Dim oHosts = new ActiveXObject("klakaut.KlAkHosts")
oHosts.AdmServer = AcquireAdServerProxy()
Dim strHostName = hostid
Dim oProps = new ActiveXObject("klakaut.KlAkParams")
oProps.Item("KLHST_WKS_COMMENT") = comment
oHosts.UpdateHost(strHostName, oProps)
End Function
Function Update_Host_Group(hostid,groupid)
Dim oHosts = New ActiveXObject("klakaut.KlAkHosts")
oHosts.AdmServer = AcquireAdServerProxy()
var strHostName = hostid
var oProps = New ActiveXObject("klakaut.KlAkParams")
oProps.Item("KLHST_WKS_GROUPID") = groupid
oHosts.UpdateHost(strHostName, oProps)
End Function
//Calling Functions
Update_Host_Comment("SomeHostID","Some Comment Text")
Update_Host_Group("SomeHostID","Some GroupID")
Here is another Version of the "Update_Host_Comment".
Changed to a Sub, and Defined the Parametertypes as Integer (hostid) and String (comment).
Sub Update_Host_Comment(hostid As Integer, comment As String)
Dim oHosts = new ActiveXObject("klakaut.KlAkHosts")
oHosts.AdmServer = AcquireAdServerProxy()
Dim strHostName = hostid
Dim oProps = new ActiveXObject("klakaut.KlAkParams")
oProps.Item("KLHST_WKS_COMMENT") = comment
oHosts.UpdateHost(strHostName, oProps)
End Sub
Maybe this will help.
This is not Working Code.
Just to get an intro by your example, and I am not a VB Guru.
c.u. from sunny Hamburg