Click here to Skip to main content
15,923,197 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: Reading Non-Ole File Property Pin
thonti9-Jun-08 3:50
thonti9-Jun-08 3:50 
For reading Non ole files(office 2007 files)

if (NonOLEGetMetaHandler(m_bstrFileName, &clsidMetaHandler) == S_OK)
{
CoInitialize(NULL);
// Create instance of the Metadata Handler object...
hr = CoCreateInstance(clsidMetaHandler, NULL, CLSCTX_INPROC, IID_IPersistFile,(void**)&prtsf);
if (SUCCEEDED(hr))
{
// Ask it to load the file for parsing...
hr = prtsf->Load(m_bstrFileName, (STGM_READWRITE | STGM_SHARE_EXCLUSIVE));
if (SUCCEEDED(hr))
{
// If it succeeded, ask for the property set storage...
hr = prtsf->QueryInterface(IID_IPropertySetStorage,(void**)&m_pPropSetStg);
if (SUCCEEDED(hr))
{
//ASSIGN_INTERFACE(m_pPrstFile, prtsf);
// hr= m_pPropSetStg->Create(FMTID_SummaryInformation,
// 0,
// PROPSETFLAG_DEFAULT,
// STGM_READWRITE | STGM_SHARE_EXCLUSIVE,&m_pSummaryInfoStg);
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;
}
prtsf->Release();
}
}
HRESULT CFileProperties::NonOLEGetMetaHandler(LPCWSTR pwszFile, LPCLSID lpClsid)
{
HRESULT hret = REGDB_E_CLASSNOTREG; // Assume no handler
HKEY hkeyExt, hkeyHandler = NULL;
LPSTR pszExt;

if ((pwszFile == NULL) || (*pwszFile == L'\0') || (lpClsid == NULL))
return E_INVALIDARG;

// Get the extension for the file...
pszExt = NonOLEConvertToMBCS(GetExtensionPart(pwszFile), CP_ACP);
if (pszExt == NULL) return E_OUTOFMEMORY;

// Now get the key that is associated with that extension...
hkeyExt = GetHKCRKey("%s", pszExt);
if (hkeyExt)
{
// Check for the handler under that key...
hkeyHandler = GetHKCRKey("%s\\ShellEx\\PropertyHandler", pszExt);
if (hkeyHandler == NULL)
{
CHAR szType[MAX_PATH];
DWORD dwT, cb = MAX_PATH; szType[0] = '\0';
// If it does exist there, check under the associated type...
if ((RegQueryValue(hkeyExt, NULL, szType, (LONG*)&cb) == ERROR_SUCCESS) && (cb))
{
hkeyHandler = GetHKCRKey("%s\\ShellEx\\PropertyHandler", szType);
if (hkeyHandler == NULL)
{
// If still no handler, you can check for handler on the "perceivedtype", which normally
// is for things like images that can have multiple extensions to single base type...
cb = MAX_PATH; szType[0] = '\0';
if ((RegQueryValueEx(hkeyExt, "PerceivedType", NULL, &dwT, (BYTE*)szType, &cb) == ERROR_SUCCESS) &&
(cb) && (dwT == REG_SZ))
{
hkeyHandler = GetHKCRKey("SystemFileAssociations\\%s\\ShellEx\\PropertyHandler", szType);
}

}
}
}

RegCloseKey(hkeyExt);
}

// If we got a reg key, then there is an handler key, lookup the GUID and provide to the caller...
if (hkeyHandler)
{
CHAR szGUID[80];
DWORD cb = 80; szGUID[0] = '\0';
if ((RegQueryValue(hkeyHandler, NULL, szGUID, (LONG*)&cb) == ERROR_SUCCESS) && (cb))
{
BSTR bstrGuid = NonOLEConvertToBSTR(szGUID, CP_ACP);
if (bstrGuid)
{
hret = CLSIDFromString(bstrGuid, lpClsid);
SysFreeString(bstrGuid);
}
}

RegCloseKey(hkeyHandler);
}

CoTaskMemFree(pszExt);
return hret;
}

hi

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 
AnswerRe: Changing The Title & Icon Of Dialog Box At Run Time Pin
Nelek17-May-08 8:26
protectorNelek17-May-08 8:26 

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.