Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can access the object's properties via the <a href="http://msdn.microsoft.com/en-us/library/ms221608.aspx" rel="nofollow"><code>IDispatch</code></a> interface and its methods <a href="http://msdn.microsoft.com/en-us/library/ms221306.aspx" rel="nofollow"><code>GetIDsOfNames</code></a> and <a href="http://msdn.microsoft.com/en-us/library/ms221479.aspx" rel="nofollow"><code>Invoke</code></a>.</p> <p>Depending on your definition of <code>myMethod</code>, you should be receiving <code>obj</code> as either a <a href="http://msdn.microsoft.com/en-us/library/ms221627.aspx" rel="nofollow"><code>VARIANT</code></a> or an <code>IDispatch *</code> in your C++ code. If a <code>VARIANT</code>, <code>vt</code> should be <code>VT_DISPACTH</code>, in which case you can safely dereference <code>pdispval</code>.</p> <p>Once you have an <code>IDispatch</code> pointer, you can use <code>GetIDsOfNames</code> to get the <a href="http://msdn.microsoft.com/en-us/library/ms221242.aspx" rel="nofollow"><code>DISPID</code></a> for a property that you're interested in like so:</p> <pre><code>_bstr_t sPropertyName = L"myProperty"; DISPID dispid = 0; HRESULT hr = pDispatch-&gt;GetIDsOfNames(IID_NULL, &amp;sPropertyName, 1, LOCALE_SYSTEM_DEFAULT, &amp;dispid); if(SUCCEEDED(hr)) { ... </code></pre> <p>Once you have successfully received your <code>DISPID</code>, you must call <code>Invoke</code> differently according to whether you would like to get a value, set a value or call a method.</p> <p>For instance, to get a value:</p> <pre><code> VARIANT vValue; hr = pDispatch-&gt;Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, 0, &amp;vValue, 0, 0); if(SUCCEEDED(hr)) { ... </code></pre> <p>See the documentation for <code>Invoke</code> for more information about the different permutations when calling it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload