Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
1.5 KiB

//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1996 - 1997.
//
// File: oleinit.hxx
//
// Contents:
//
// Classes:
//
// Functions:
//
// Coupling:
//
// Notes:
//
// History: 11-11-1996 ericne Created
//
//----------------------------------------------------------------------------
#ifndef _COLEINIT
#define _COLEINIT
//+---------------------------------------------------------------------------
//
// Class: COleInitialize ()
//
// Purpose:
//
// Interface: fIsInitialized -- BOOL which determines whether a call
// to OleUninitialize is necessary
//
// History: 11-11-1996 ericne Created
//
// Notes:
//
//----------------------------------------------------------------------------
class COleInitialize
{
BOOL fIsInitialized;
public:
COleInitialize( )
: fIsInitialized( FALSE )
{
HRESULT hr = OleInitialize( NULL );
if( S_OK == hr || S_FALSE == hr )
{
fIsInitialized = TRUE;
}
else
{
printf( "ERROR : OleInitialize returned 0x%08x\r\n", hr );
exit( -1 );
}
}
~COleInitialize( )
{
if( fIsInitialized )
OleUninitialize( );
}
};
#endif