I have create a Com Object with delphi5, and VB6 can not call its method returning BSTR.I use safecall
if I define the method
Type library Editor
HRESULT _stdcall getString([out, retval] BSTR strValue )
Interface
getString:WideString;safecall;
Implement
getString:WideString;safecall;
the vb6 class browser will crashed when browse the classif I define the method
Type library Editor
BSTR _stdcall getString( void );
Interface
getString:WideString;safecall;
Implement
getString:WideString;safecall;
it will invoke a access violation error when i call the method.what is wrong with me? I will highly appreciate your help. thanks.
if I define the method
Type library Editor
HRESULT _stdcall getString([out, retval] BSTR strValue )
Interface
getString:WideString;safecall;
Implement
getString:WideString;safecall;
the vb6 class browser will crashed when browse the classif I define the method
Type library Editor
BSTR _stdcall getString( void );
Interface
getString:WideString;safecall;
Implement
getString:WideString;safecall;
it will invoke a access violation error when i call the method.what is wrong with me? I will highly appreciate your help. thanks.
返回值使用BSTR可能是VB把返回值当作HRESULT,把你的返回值当成错误值处理了。