Access Info File C++ Source Code
Access Info File C++ Source Code
Access Info File C++ Source Code
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <ole2.h>
if( FAILED(hr) )
throw L"Failed StgOpenStorageEx";
/*
hr = pPropSetStg->Open( PropSetfmtid,
STGM_WRITE|
STGM_SHARE_EXCLUSIVE,
&pPropStg );
*/
if( FAILED(hr) )
throw L"Failed IPropertySetStorage::Open";
propspec.ulKind = PRSPEC_PROPID;
propspec.propid = 0x00000002;
hr = pPropStg->WriteMultiple( 1, &propspec,
&propWrite, PID_FIRST_USABLE );
if( FAILED(hr) )
throw L"Failed IPropertyStorage::WriteMultiple";
pPropStg->Release();
pPropStg = NULL;
hr = pPropSetStg->Open( PropSetfmtid,
STGM_READ|STGM_SHARE_EXCLUSIVE,
&pPropStg );
if( FAILED(hr) )
throw L"Failed IPropertySetStorage::Open";
if( hr == S_FALSE )
throw L"Property didn't exist after "
L"reopening the property set";
else if( propWrite.vt != propRead.vt )
throw L"Property types didn't match "
L"after reopening the property set";
else if( wcscmp( propWrite.pwszVal, propRead.pwszVal ) != 0 )
throw L"Property values didn't match"
L" after reopening the property set";
else
wprintf( L"Success\n" );
return 0;
}