Page 1 of 1
how to get Comate invoke return value?
Posted: Sun Feb 22, 2009 12:50 pm
by john lory
code like:
Code: Select all
flashobject\invoke("CallFunction('" + cmd + "')")
the CallFunction is flash ocx control method,prototype like:
Code: Select all
# CallFunction
# [b]retType: string[/b]
# params:
# request
# in:True out:False optional:False type:string
#
it have return value, but how can i to get the retrun value :roll:
Posted: Sun Feb 22, 2009 12:57 pm
by srod
Invoke() should not be used to retrieve a property value.
Use GetStringProperty() instead in the case you outline.
btw, why are you posting this in the Tricks 'n' Tips section?
Posted: Sun Feb 22, 2009 2:21 pm
by john lory
srod wrote:Invoke() should not be used to retrieve a property value.
----CallFunction is NOT property,but a METHOD at flash control
Use GetStringProperty() instead in the case you outline.
btw, why are you posting this in the Tricks 'n' Tips section?
---I post this thread at the error section....
and how to delete this thread?
I add a method to Comate:
Code: Select all
Procedure.s COMateClass_InvokeReturnStringMethod(*this._membersCOMateClass, command$)
Protected result.i = #S_OK, retVar.VARIANT, result$
If command$
result = COMateClass_INTERNAL_Invoke(*this, #DISPATCH_METHOD, #VT_BSTR, retVar, command$)
If SUCCEEDED(result) And retVar\bstrVal
result$ = PeekS(retVar\bstrVal, -1, #PB_Unicode)
EndIf
VariantClear_(retVar)
Else
result = #E_INVALIDARG
EndIf
;Set any error code. iDispatch errors will alreay have been set.
COMateClass_INTERNAL_SetError(*this, result)
ProcedureReturn result$
EndProcedure
it is copied from COMateClass_GetStringProperty and minor modification,but it only return String value,It works well

!!!!
perhapse comate should be added individual invoke method for a variety of types like integer/real/....
Comate is great works!! thanks again
Posted: Sun Feb 22, 2009 3:22 pm
by john lory
in fact ,it is unnecessary that to add new methods, only invoke corresponding type accessing method.
for flash CallFunction method,code like:
Code: Select all
...
rr.s = flashobject\GetStringProperty("CallFunction('" + cmd + "')")
Debug rr
...
it works
Posted: Sun Feb 22, 2009 8:56 pm
by srod
John, I am confused here; have you actually read the COMate manual and studied some of the demos?
COMate has methods for returning integer properties, real properties, string properties, object properties... You really do not need to alter the COMate source for this.