home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / activedoc / createdocfile.cpp < prev    next >
C/C++ Source or Header  |  1998-04-03  |  624b  |  31 lines

  1. #include <windows.h>
  2. #include "ActiveDoc_i.c"
  3.  
  4. // Creates a compound file which can be used to host ActiveDoc in Internet Explorer
  5. // Compile with
  6. // cl createdocfile.cpp /link ole32.lib
  7. // Use ActiveDoc.htm to test - after this program has been run.
  8.  
  9. void main ()
  10. {
  11.     HRESULT hr = CoInitialize(NULL);
  12.     if (FAILED(hr))
  13.         return;
  14.  
  15.     IStorage  * pStorage = NULL;
  16.  
  17.     hr = StgCreateDocfile(
  18.         L"ActiveDoc.AAA",
  19.         STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE ,
  20.         NULL,
  21.         &pStorage);
  22.  
  23.     if (SUCCEEDED(hr))
  24.     {
  25.         pStorage->SetClass(CLSID_CActiveDoc);
  26.         pStorage->Release();
  27.     }
  28.  
  29.     CoUninitialize();
  30. }
  31.