home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap18 / cosmo1.0 / oleexit.c < prev    next >
C/C++ Source or Header  |  1995-05-03  |  1KB  |  56 lines

  1. /*
  2.  * OLEEXIT.C
  3.  *
  4.  * Functions for final OLE cleanup.
  5.  *
  6.  * Copyright(c) Microsoft Corp. 1992-1994 All Rights Reserved
  7.  * Win32 version, January 1994
  8.  */
  9.  
  10.  
  11. #ifdef MAKEOLESERVER
  12.  
  13. #include <windows.h>
  14. #include <ole.h>
  15. #include "cosmo.h"
  16. #include "oleglobl.h"
  17.  
  18.  
  19. /*
  20.  * FOLEExit
  21.  *
  22.  * Purpose:
  23.  *  Handles OLE-server specific shutdown
  24.  *    1.  Free the OLESERVER structure.
  25.  *    2.  Free the procedure instances the server's VTBLs.
  26.  *
  27.  * Parameters:
  28.  *  pOLE            LPXOLEGLOBALS to OLE-specific global variable block.
  29.  *
  30.  * Return Value:
  31.  *  BOOL            FALSE if an error occurred, otherwise TRUE.
  32.  */
  33.  
  34. BOOL WINAPI FOLEExit(LPXOLEGLOBALS pOLE)
  35.     {
  36.     /*
  37.      * Dump the server.  We depend on ServerRelease and DocRelease to
  38.      * clean up documents and objects.  Choosing File/Exit has already
  39.      * revoked the server.  This is simply final cleanup.
  40.      */
  41.     if (NULL!=pOLE)
  42.         {
  43.         if (NULL!=pOLE->pSvr)
  44.             LocalFree(pOLE->pSvr->hMem);
  45.         }
  46.  
  47.     OLEVtblFreeServer  (&pOLE->vtblSvr);
  48.     OLEVtblFreeDocument(&pOLE->vtblDoc);
  49.     OLEVtblFreeObject  (&pOLE->vtblObj);
  50.  
  51.     return TRUE;
  52.     }
  53.  
  54.  
  55. #endif //MAKEOLESERVER
  56.