Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Drawing a bitmap on DC created by BYTE* array [modified] Pin
Baltoro18-May-08 12:20
Baltoro18-May-08 12:20 
AnswerRe: Drawing a bitmap on DC created by BYTE* array Pin
Dan18-May-08 13:31
Dan18-May-08 13:31 
AnswerRe: Drawing a bitmap on DC created by BYTE* array Pin
TalSt18-May-08 19:27
TalSt18-May-08 19:27 
Questionfile accessing problem Pin
Chandrasekharan P18-May-08 3:26
Chandrasekharan P18-May-08 3:26 
AnswerRe: file accessing problem Pin
Nelek18-May-08 7:15
protectorNelek18-May-08 7:15 
AnswerRe: file accessing problem Pin
chandu00418-May-08 19:53
chandu00418-May-08 19:53 
QuestionReading Non-Ole File Property Pin
tprakash18-May-08 3:00
tprakash18-May-08 3:00 
AnswerRe: Reading Non-Ole File Property Pin
thonti29-May-08 23:41
thonti29-May-08 23:41 
for non- ole file types we have to get pointer of IID_IPropertySetStorage rather than istorage and the rest will be the same.
only problme here is we cant update office 2007 file type as the file structure of office 2007 file type is bit different.
if you fine any solution for accessing office 2007 do let me know.
if(nFileType == non- ole)
{
hr =SetPropertySetStorage(pszFilePath);
if (hr == S_OK )
{
hr = SetSummaryInfoStorage();
if(FAILED(hr))
{
printf(" Summaryinfo storage failed w/error %08lx", hr);
return hr;
}

hr = SetCustomInfoStorage();
if(FAILED(hr))
{
printf(" Custom storage failed w/error %08lx", hr);
return hr;
}
}
else
{
return hr;
}

}

HRESULT CFileProperties::SetPropertySetStorage(const char * pszFilePath )
{
HRESULT hr = S_OK;
if(pszFilePath == NULL && m_pStorage != NULL)
{
hr = m_pStorage->QueryInterface(IID_IPropertySetStorage, (void **)&m_pPropSetStg);
if(FAILED(hr))
{
printf("QI for IPropertySetStorage failed w/error %08lx", hr);
//Releasing IStorage
m_pStorage->Release();
m_pStorage = NULL;
return hr;
}

}
else if(pszFilePath != NULL && m_pStorage == NULL)
{
// Translate filename to Unicode.
WCHAR wcFilename[1024];
setlocale( LC_ALL, "" );

int i = mbstowcs(wcFilename, pszFilePath , strlen(pszFilePath ));

setlocale( LC_ALL, "C" );
wcFilename[i] = 0;

// Open the document as an OLE compound document.
hr = StgOpenStorageEx( wcFilename,
STGM_READ|STGM_SHARE_DENY_WRITE,
STGFMT_ANY,
0, NULL, NULL,
IID_IPropertySetStorage,
reinterpret_cast<void**>(&m_pPropSetStg) );

if(FAILED(hr))
{
if(hr == STG_E_FILENOTFOUND)
printf("File not found.");
else if(hr == STG_E_FILEALREADYEXISTS)
printf("Not a compound file.");
else
printf("StgOpenStorage() failed w/error %08lx", hr);
return hr;
}
}
return hr;
}

HRESULT CFileProperties::SetSummaryInfoStorage()
{
HRESULT hr = S_FALSE;
if(m_pPropSetStg != NULL)
{
// Create SummaryInformation, getting an IpropertyStorage.
hr= m_pPropSetStg->Create(FMTID_SummaryInformation,
0,
PROPSETFLAG_DEFAULT,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE,&m_pSummaryInfoStg);

//propertystorage already exists for SummaryInformation
if(hr == STG_E_FILEALREADYEXISTS )
{
// Open summary information, getting an IpropertyStorage.
hr = m_pPropSetStg->Open(FMTID_SummaryInformation,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &m_pSummaryInfoStg);

if(FAILED(hr))
{
printf("No Summary-Information.\n");
return hr;
}
}
}
return hr;
}
HRESULT CFileProperties::SetCustomInfoStorage( )
{
HRESULT hr = S_FALSE;
if(m_pPropSetStg != NULL)
{
// Create UserDefinedProperties, getting an IpropertyStorage.
hr= m_pPropSetStg->Create(FMTID_UserDefinedProperties,
0,
PROPSETFLAG_DEFAULT,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE,&m_pCustomInfoStg);


//propertystorage already exists for UserDefinedProperties
if(hr == STG_E_FILEALREADYEXISTS )
{
// Open User-Defined-Properties, getting an IpropertyStorage.
hr = m_pPropSetStg->Open(FMTID_UserDefinedProperties,
STGM_READWRITE| STGM_SHARE_EXCLUSIVE, &m_pCustomInfoStg);//| STGM_WRITE
if(FAILED(hr))
{
printf("No User Defined Properties.\n");
return hr;
}
}
}
return hr;
}

hi

AnswerRe: Reading Non-Ole File Property Pin
thonti9-Jun-08 3:50
thonti9-Jun-08 3:50 
Questioninvalid number of parameters in ActiveX Pin
samira forooghi18-May-08 0:37
samira forooghi18-May-08 0:37 
AnswerRe: invalid number of parameters in ActiveX Pin
Nelek18-May-08 0:39
protectorNelek18-May-08 0:39 
GeneralRe: invalid number of parameters in ActiveX Pin
samira forooghi19-May-08 1:55
samira forooghi19-May-08 1:55 
AnswerRe: invalid number of parameters in ActiveX Pin
prasad_som18-May-08 1:04
prasad_som18-May-08 1:04 
QuestionGetControlUnknown Pin
subramanyeswari18-May-08 0:08
subramanyeswari18-May-08 0:08 
AnswerRe: GetControlUnknown Pin
JudyL_MD18-May-08 12:39
JudyL_MD18-May-08 12:39 
QuestionDraw on desktop Pin
capint17-May-08 23:06
capint17-May-08 23:06 
AnswerRe: Draw on desktop [modified] Pin
Nelek17-May-08 23:47
protectorNelek17-May-08 23:47 
GeneralRe: Draw on desktop Pin
capint18-May-08 2:07
capint18-May-08 2:07 
GeneralRe: Draw on desktop Pin
Nelek18-May-08 7:04
protectorNelek18-May-08 7:04 
QuestionSave data into a DataBase Pin
cuesdean florin17-May-08 21:46
cuesdean florin17-May-08 21:46 
AnswerRe: Save data into a DataBase Pin
David Crow19-May-08 4:45
David Crow19-May-08 4:45 
QuestionC# SendMessage in C++ Pin
luisgrimaldo17-May-08 17:59
luisgrimaldo17-May-08 17:59 
AnswerRe: C# SendMessage in C++ Pin
Hamid_RT17-May-08 19:12
Hamid_RT17-May-08 19:12 
QuestionNeed XML Alternative for Persisting Object Data Pin
Peter Weyzen17-May-08 16:28
Peter Weyzen17-May-08 16:28 
QuestionChanging The Title & Icon Of Dialog Box At Run Time Pin
Joseph Marzbani17-May-08 8:05
Joseph Marzbani17-May-08 8:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.