MAPX在VC和C++builder的OCX导入类的比较。
2004-11-13 01:06
381 查看
下面是VC++和CB的OCX导入类的比较,可以看到CB用OCX是多么的麻烦。看来用CB做MAPX是一个错误的选择。
声明返回值:TAutoArgs<0> _args,而VC用double result;
代理方法:OlePropertyGet(_dispid, _args);而VC用GetProperty(0x5, VT_R8, (void*)&result);
返回:return _args.GetRetVariant();而VC用return result;
声明返回值:TAutoArgs<0> _args,而VC用double result;
代理方法:OlePropertyGet(_dispid, _args);而VC用GetProperty(0x5, VT_R8, (void*)&result);
返回:return _args.GetRetVariant();而VC用return result;
C++ Builder | VC++ |
OCX_H的内容摘录 interface CMapXRectangle : public TDispWrapper<IDispatch> {.... double /*[VT_R8:0]*/ __fastcall get_Height() { _TDispID _dispid(/* Height */ DISPID(5)); TAutoArgs<0> _args; OlePropertyGet(_dispid, _args); return _args.GetRetVariant(); } ... } LIB_H的内容摘录: template <class T> void __fastcall CMapXRectangleDispT<T>::set_Height(double /*[VT_R8:0]*/ Value) { _TDispID _dispid(*this, OLETEXT("Height"), DISPID(5)); TAutoArgs<1> _args; _args[1] = Value; OlePropertyPut(_dispid, _args); } | double CCMapXRectangle::GetHeight() { double result; GetProperty(0x5, VT_R8, (void*)&result); return result; } |