Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-20-2004, 07:44 PM
Junior Member
 
Join Date: Nov 2004
Posts: 2
Default ActiveX Out Params (Return Values)

Hello,

Is it possible to access return/output parameters from ActiveX controls using SWF Kit?

I have created a custom ActiveX object. I've been able to call methods on it from FFish, and have it generate events to FFish. (Using the ActiveXObject in SWFKit Pro 2).

However, I can not figure out a way to access output/return values. I am not an ActiveXObject expert, but I assumed the correct way would be to use a VARIANT* parameter marked as [out, return] in the IDL.

For example, I would like to write something like this in FFish:

var returnValue = myActiveXCtl.doSomething(inputParams);

OR

myActiveXCtl.doSomething(inputParam1, outputParam2);

...where the activeX object has changed the value of 'outputParam2' when the method returns.


Is it possible to do this? If so, any help is appreciated.

If not, what is the suggested way to have an ActiveX object return values to a FFish script? Use properties?

Thanks in advance. The SWFKit product has proved useful on a number of occassions.

- josh
Reply With Quote
  #2 (permalink)  
Old 11-22-2004, 02:11 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:ActiveX Out Params (Return Values)

SWFKit doesn't support out params. But it supports return parameters. A method of an ActiveX is something like this:

Code:
HRESULT myMethod(VARAINT param1, VARIANT param2, [out, retval]VARIANT *out);
The method can be accessed in FFish like this
Code:
var myValue = myActiveX.myMethod(param1, param2);
SWFKit only supports out params in the event handlers of ActiveX objects.

E.g.
Code:
LRESULT onSomething(VARIANT param1, [out]VARIANT *param2);
In the FFish
Code:
myActiveX.onSomething = function (param1, param2)
{
    ...
    param2.value = "OK";
}
The FFish scripting language converts the [out] paramter to a FFish object contains a property "value". The value of the out parameter can be get or set by accessing the "value" property of the FFish object.
Reply With Quote
  #3 (permalink)  
Old 11-22-2004, 07:08 PM
Junior Member
 
Join Date: Nov 2004
Posts: 2
Default Re:ActiveX Out Params (Return Values)

Thank you. That works.

Fwiw, I had originally tried that method signature, but I had not correctly set the Variant.vt property. For anyone else that stumbles upon this, be sure to have your ActiveX code similar to the following for returning a string to FFish:

Code:
STDMETHODIMP ActiveXLib::myMethod(VARIANT* outParam)
{
   CComBSTR str;
   strAppend(L"Testing");

   outParam->bstrVal = tmp.Copy();
   outParam->vt = VT_BSTR;  // <-- this is what I forgot initially. Might be common ActiveX knowledge.

   return S_OK;
}
Before setting the type correctly, I was getting "undefined property" as the return in FFish.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:34 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.