最近做了一个基于ATL的控件,设计了一个接口,想返回多个参数,但是通过JavaScript却无法得到返回值,本来以为是自己接口的问题,后来在网上找了很多才发现原来MSDN已经有了明确的说法:
JavaScript does not support passing parameters by reference. JavaScript will make copies of these variables and pass them by value when calling methods that take by-reference parameters. Thus, you cannot get a return value via a method parameter when using JavaScript.
--------------------------------------------------------------------------------------------------------------------------
接口定义
[id(10), helpstring("method getAxisBaseInfo")] HRESULT getAxisBaseInfo(BSTR uuid_bstr, LONG obj_id, SHORT index, [out] BSTR* name, [out] BSTR* type, [out] DOUBLE* start, [out] DOUBLE* end, [out] DOUBLE* step, [out] DOUBLE* subStep, [out] LONG* precision);
期望能返回多个参数,在JS里行不通。
时间: 2024-11-05 17:32:53