title: How to convert VARIANT_BOOL* to bool*
body: <p>I found <a href="https://stackoverflow.com/questions/886729/how-to-best-convert-variant-bool-to-c-bool">this</a> question, but they aren't using a pointer.</p>
  
  <p>I have a method that my COM method calls that requires a pointer to a bool. This bool is used to cancel the long running process (video recording, if you must know) from the caller.</p>
  
  <p>Can I cast it somehow, but still have VARIANT_BOOL equate to FALSE and vice-versa?</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>HRESULT YourObject::YourComMethod(VARIANT_BOOL* pVarBool)
  {
      callYourNonComMethodHere((bool*)pVarBool);
      return S_OK;
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>So, I learned that, although you can have COM parameters as pointers, but they serve no purpose. That don't actually reference the pointer from the caller.</p>
  
  <p>So, what I had to do was make a totally separate COM object that is my <code>CancellationToken</code>. Then, in my implementation, I can call <code>token.Cancel()</code>, and then the <code>YourComMethod</code> will have the updated bool, indicating that the long running method should cancel.</p>
  
  <p>I created a sample project to demonstrate how I was able to pass a pointer to a bool, using a wrapping COM object.</p>
  
  <p><a href="https://bitbucket.org/theonlylawislove/so-blocking-com-call/src" rel="nofollow noreferrer">https://bitbucket.org/theonlylawislove/so-blocking-com-call/src</a></p>