title: How to get the return value of IStaticPortMappingCollection.Add return or not?
body: <p>I use seattle in windows 10 64 bit.</p>
  
  <p>I try to forward a port by upnp and get the return value. The port forwarding works well but the following line makes 'could not convert variant of type (dispatch) into type (integer)' window.</p>
  
  <pre><code>_hResult := _Ports.add(_PortNumber, 'TCP', _PortNumber, Edit1.Text, True, _PortName); 
  </code></pre>
  
  <p>You can find the return value type in the following msdn webpage.</p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa366148(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/aa366148(v=vs.85).aspx</a></p>
  
  <p>The whole code is</p>
  
  <pre><code>uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Win.ComObj, Vcl.StdCtrls;
  
  procedure TForm1.FormClick(Sender: TObject);
  var
    _NAT: Variant;
    _Ports: Variant;
    _PortNumber: Integer;
    _PortName: string;
    _hResult: HRESULT;
  begin
    _NAT := CreateOleObject('hnetcfg.natupnp');
    _Ports := _NAT.staticportmappingcollection;
  
    _PortNumber := 8000;
    _PortName := 'test';
  
    if VarIsClear(_Ports) then // $00000000
    begin
      Caption := 'error';
    end
    else
    begin
      _hResult := _Ports.add(_PortNumber, 'TCP', _PortNumber, Edit1.Text, True, _PortName);
  
      if _hResult = S_OK then
      begin
        Caption := 'succeeded';
      end;
    end;
  end;
  </code></pre>