After connecting to the DLL, I find a value of variable:
lLoadOk = oBridge.LoadAssembly("eZdravieSignature.dll")
lxDllValue1 = oBridge.GetProperty(oEhealthDocas,"ExternyIdentifikatorRiadku")
If this variable "ExternyIdentifikatorRiadku" does not exist, this code ends in error : OLE error code 0x8002000e - Invalid number of parameters
How to verify if variable exists - something like :
IF TYPE("variable")!="U"
Where is your code to create an instance of the type?
If this is your real code, you need to:
- Load the assembly
- Create an instance
- Then access the property on the instance
In addition you should check for errors on the LoadAssembly()
and CreateInstance()
calls to make sure these methods actually work.
+++ Rick ---
If variable "ExternyIdentifikatorRiadku" exist, them this code run O.K. and lxDllValue have real value :
oBridge = CreateObject("wwDotNetBridge","V4")
lLoadOk = oBridge.LoadAssembly("eZdravieSignature.dll")
oController = oBridge.CreateInstance("eZdravieSignature.eZdravieSignature")
oEhealthDocas = oBridge.CreateInstance("eZdravieSignature.WebReferenceEReceptV05.APIDocasnaVZS")
lxDllValue = oBridge.GetProperty(oEhealthDocas,"ExternyIdentifikatorRiadku")
How to screen for the absence of a variable
You should check for errors if it's not working. Your code has no error checking for anything. After each call check the .lError
flag and .cErrorMsg
.
You can always check for the explicit type of the result value.
*** Check for the type you're expecting
if VARTYPE(oController) # 'O'
* error handling here
endif
Probably my question is wrong. My code is :
DO wwUtils
DO wwDotNetBridge
PUBLIC oBridge AS wwDotNetBridge
PUBLIC oController AS wwDotNetBridge
oBridge = CreateObject("wwDotNetBridge","V4")
lLoadOk = oBridge.LoadAssembly("eZdravieSignature.dll")
oController = oBridge.CreateInstance("eZdravieSignature.eZdravieSignature")
oEhealthDocas = oBridge.CreateInstance("eZdravieSignature.WebReferenceEReceptV05.APIDocasnaVZS")
and this run O.K. This is definition of DLL : I need to test whether the variable is defined and what type it is (e.g. "IdTechnik") to pass on the correct value. How to handle an error if it is not defined in the DLL.
I already answered your question in my last message... You can use VARTYPE()
to check for the specific type you are expecting, but you really should be checking for errors not checking the value returned to see whether there's a problem.
+++ Rick ---