![](/img/trans.png)
[英]Getting “Invalid Floating Point” error with ActiveX Control in Delphi
[英]Error with ActiveX and MCVE
在我搜索返回 S_OK 而不是 S_FALSE 的錯誤時(請參閱我之前的消息),我制作了一個非常小的服務器,只有一個方法發送 S_FALSE(HResult 類型),不幸的是我在小客戶端程序中出錯:項目 TestTest.exe 已發送異常類 EOleSysError 並帶有消息“變量類型無效”(這是引發錯誤的指令Return:=coll.Method
)。 任何的想法? .ridl 服務器代碼:
function TTest1.Method: HResult;
begin
Result:=S_FALSE;
end;
和客戶端代碼:
procedure TForm1.Button1Click(Sender: TObject);
var
coll:variant;
Return:HResult;
begin
coll:= CreateOLEObject('Project.Test1');
Return:=coll.Method;
if Return=S_FALSE then showmessage('OK') else showmessage('ERROR!!!!!!!!!!!!!!!!');
end;
我認為您不需要HRESULT
類型的參數“值”。 您可以刪除該參數:該方法將已經返回HRESULT
。 如果您想使用參數進行測試,請嘗試將 'value' 更改為BSTR
[in] 並在那里傳遞任何字符串。 它應該工作。
Return:=coll.Method('place the parameter string here');
干杯
我不知道為什么你堅持使用HRESULT
返回值,為什么你不創建帶有參數value, type : long , modifier : in
HRESULT
方法value, type : long , modifier : in
然后返回你想要的任何東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.