title: COleException at memory location for COleSafeArray
body: <p>I'm trying to work with the following sample code that was provided to me </p>
  
  <pre><code>// select the Access levels from access level list
  BSTR myBstr = SysAllocString(L"Hello World");
  COleSafeArray saAccessLevels;
  VARIANT vAccls;
  
  saAccessLevels.CreateOneDim(VT_BSTR, 1);
  saAccessLevels.PutElement(0, myBstr); // &lt;-- Error after this line
  vAccls = saAccessLevels.Detach();
  </code></pre>
  
  <p>The Visual C++ debugger breaks at the line noted in the above comment and I get the following errors:</p>
  
  <pre><code>f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\olemisc.cpp(423) : AppMsg - Warning: constructing COleException, scode = E_INVALIDARG ($80070057).
  First-chance exception at 0x75371D4D in MyApplication.exe: Microsoft C++ exception: COleException at memory location 0x0057FC58.
  Unhandled exception at 0x75371D4D in MyApplication.exe: Microsoft C++ exception: COleException at memory location 0x0057FC58.
  </code></pre>
  
  <p>I am not familiar with C++ programming.  What am I doing wrong? </p>