-3

In my search of the error of the return of S_OK and not S_FALSE (see my previous message), I have made a very small sever with only one method wich send S_FALSE (HResult type), unfortunatly I have an error with the small client program: The project TestTest.exe has send the exception class EOleSysError with the message 'variable type invalid' (it's the instruction Return:=coll.Method which raise the error). Any idea? The .ridl the server code:

function TTest1.Method: HResult;
begin
  Result:=S_FALSE;
end;

and the client code:

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;

for the full problem I have made an MCVE: the server: enter link description here the client: enter link description here

michastro
  • 91
  • 9

2 Answers2

0

I dont think you need the parameter 'value' of type HRESULT. You can delete that parameter: the method will already return HRESULT. If you want to test with a parameter, try changing 'value' to BSTR [in] and pass any string there. It should work.

Return:=coll.Method('place the parameter string here');

Cheers

ketan
  • 19,129
  • 42
  • 60
  • 98
  • Unfortunatly your are false, if I remove the parameter 'Value' of type `HResult`, the function `Method` become a procedure. The test I want to make is especially with the type `HRESULT` because my problem is with this parameter. – michastro Aug 31 '15 at 08:39
  • @michastro We are nearly two weeks in to this investigation, and still there is no MCVE. Why not? I'm betting that you are exporting `register` calling convention functions. But if you won't show an MCVE, all we can do is guess. Please trust me that I know what I am talking about. I know how to get solutions to problems. You make an MCVE, we give you a definitive answer, you go away happy. It's really that simple. – David Heffernan Aug 31 '15 at 09:43
  • I am sorry David but I have posted a MCVE 6 days ago, and nobody has answered something! – michastro Aug 31 '15 at 09:50
  • We need this in the question and not an off site link – David Heffernan Aug 31 '15 at 21:43
  • @michastro: No, you didn't. You first posted a link to an off-site download, and then you posted a large code dump. Neither of those are an MCVE - the code dump is hardly **minimal*. – Ken White Aug 31 '15 at 23:34
0

i don't know why you Stuck with HRESULT to return value , why you don't create HRESULT METHOD with parameter value, type : long , modifier : in then return what ever you want .

MartinLoanel
  • 184
  • 3
  • 17
  • I haven't the choice, I want to test the bad return of `Next` and `Reset` in an IEnumVariant, so I want to make a copy of theses functions to find why S_FALSE is changed in S_OK. – michastro Aug 31 '15 at 21:21