title: Delphi XE2. ActiveX. How to call GetIDsOfNames for resolve Method ID for few methods?
body: <p>How to call GetIDsOfNames for resolve Method ID for few methods? It works fine for resolve only one or first-one MethodID.</p>
  
  <p>My code right now:</p>
  
  <pre><code>   pDisp         : IDispatch;
  
     intResult     : HResult;
     NameCount     : integer;
  
     DispIDs       : array [0..2] of Integer;
  
     WideNames     : array of WideString;
     I             : Integer;
     Names, Src    : PAnsiChar;
     N             : array [0..2] of PAnsiChar;
  
     begin
            pDisp := CreateOleObject (edtPrgID1.Text);
  
            if VarIsNull (pDisp) or VarIsEmpty (pDisp) then
                   Exit;
  
            //-=-
  
            NameCount := 3;
            Names := 'doF4' + #0 + 'doF5' + #0 + 'doF6' + #0;
  
            //-=- 
  
            SetLength (WideNames, NameCount);
            Src := Names;
            for I := 0 to NameCount - 1 do
            begin
                   if I = 0 then
                         WideNames [I] := UTF8ToWideString (Src)
                   else
                         WideNames [NameCount - I] := UTF8ToWideString (Src);
                   Inc (Src, StrLen (Src) + 1);
            end;
  
            intResult := pDisp.GetIDsOfNames (GUID_NULL, WideNames, NameCount, LOCALE_SYSTEM_DEFAULT, @DispIDs);
  </code></pre>
  
  <p>I am trying to work with my own ActiveX COM (DLL) component. All method 100% exists and valid.</p>
  
  <p>I am not sure why, but in <strong>DispIDs</strong> I always get result only for first method (in my sample “doF4”), for all other methods I get -1.
  So, <strong>DispIDs</strong> after execution <strong>pDisp.GetIDsOfNames</strong> looks like <strong>(205, -1, -1)</strong>.</p>