Click here to Skip to main content
15,917,991 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About OnCtlColor Pin
RChin1-Jul-03 23:15
RChin1-Jul-03 23:15 
QuestionIs it .Net or Vc++ 6.0? Pin
Anonymous1-Jul-03 6:52
Anonymous1-Jul-03 6:52 
AnswerRe: Is it .Net or Vc++ 6.0? Pin
basementman1-Jul-03 7:42
basementman1-Jul-03 7:42 
GeneralRetrieving file name and path from Office applications Pin
Member 3600821-Jul-03 6:09
Member 3600821-Jul-03 6:09 
Generalgetting file property, help help help Pin
pnpfriend1-Jul-03 5:51
pnpfriend1-Jul-03 5:51 
GeneralRe: getting file property, help help help Pin
David Crow1-Jul-03 6:05
David Crow1-Jul-03 6:05 
GeneralRe: getting file property, help help help Pin
Peter Weyzen1-Jul-03 9:43
Peter Weyzen1-Jul-03 9:43 
GeneralRe: getting file property, help help help Pin
pnpfriend1-Jul-03 10:52
pnpfriend1-Jul-03 10:52 
Thank you for your reply.. I need to know the application name of the file which doesn't have an extension.

I have the following code and it only work for MS Office files but not for others like .tiff, .txt, pdf..etc
if the file is not MS Office files, then the hr = pPropSet->Open(FMTID_Summary.... set the hr to FAILED.
It never get executed DumpBuiltInProps(pPropStg,appname);


<br />
bool GetAppName(char* filename,char *appname)<br />
	{<br />
			// Translate filename to Unicode.<br />
      WCHAR wcFilename[1024];<br />
      setlocale( LC_ALL, "" );<br />
      int i = mbstowcs(wcFilename, filename, strlen(filename));<br />
      setlocale( LC_ALL, "C" );<br />
      wcFilename[i] = 0;<br />
<br />
      HRESULT hr = S_OK;<br />
			IStorage* pStg = NULL;<br />
			hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_DOCFILE, 0, NULL, NULL, IID_IStorage, (void**)&pStg);<br />
			if(FAILED(hr))<br />
			{<br />
				hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_ANY, 0, NULL, NULL, IID_IStorage, (void**)&pStg);<br />
				if(FAILED (hr))<br />
					return false;<br />
			}<br />
			<br />
			IPropertySetStorage* pPropSet = NULL;<br />
			hr = pStg->QueryInterface(IID_IPropertySetStorage, (void**)&pPropSet);<br />
			if(FAILED(hr))<br />
			{<br />
				pStg->Release();<br />
				return false;<br />
			}<br />
			<br />
			IPropertyStorage *pPropStg = NULL;<br />
		<font color=red>	hr = pPropSet->Open(FMTID_SummaryInformation,STGM_READ|STGM_SHARE_EXCLUSIVE,&pPropStg);<br />
			if(FAILED(hr))<br />
			{<br />
				pPropSet->Release();<br />
				pStg->Release();<br />
				return false;<br />
			}</font><br />
			DumpBuiltInProps(pPropStg,appname);<br />
			<br />
			pPropSet->Release();<br />
			pStg->Release();<br />
			return true;<br />
			// Initialize PROPSPEC for the properties you want.<br />
    <br />
		<br />
	}<br />

GeneralRe: getting file property, help help help Pin
Peter Weyzen1-Jul-03 11:35
Peter Weyzen1-Jul-03 11:35 
GeneralRe: getting file property, help help help Pin
David Crow12-Sep-03 9:36
David Crow12-Sep-03 9:36 
Generalcreating an array of structures Pin
johnstonsk1-Jul-03 5:44
johnstonsk1-Jul-03 5:44 
GeneralRe: creating an array of structures Pin
Manfred Staiger1-Jul-03 5:59
Manfred Staiger1-Jul-03 5:59 
GeneralRe: creating an array of structures Pin
David Crow1-Jul-03 6:08
David Crow1-Jul-03 6:08 
GeneralRe: creating an array of structures Pin
johnstonsk1-Jul-03 6:30
johnstonsk1-Jul-03 6:30 
GeneralRe: creating an array of structures Pin
David Crow1-Jul-03 6:56
David Crow1-Jul-03 6:56 
GeneralRe: creating an array of structures Pin
David Crow1-Jul-03 10:57
David Crow1-Jul-03 10:57 
GeneralDatabase Easy Question Pin
Scozturk1-Jul-03 5:35
professionalScozturk1-Jul-03 5:35 
GeneralRe: Database Easy Question Pin
David Crow1-Jul-03 6:09
David Crow1-Jul-03 6:09 
GeneralRe: Database Easy Question Pin
Toni781-Jul-03 18:58
Toni781-Jul-03 18:58 
GeneralModeless Dialogs Pin
Jay Hova1-Jul-03 5:35
Jay Hova1-Jul-03 5:35 
GeneralRe: Modeless Dialogs Pin
valikac1-Jul-03 5:39
valikac1-Jul-03 5:39 
GeneralRe: Modeless Dialogs Pin
David Crow1-Jul-03 6:23
David Crow1-Jul-03 6:23 
GeneralRe: Modeless Dialogs Pin
Jay Hova1-Jul-03 6:37
Jay Hova1-Jul-03 6:37 
GeneralProblem with COMIP.H Pin
ThaisFurlan1-Jul-03 5:01
ThaisFurlan1-Jul-03 5:01 
Generalaudio settings in xp - help Pin
alonk1-Jul-03 4:29
alonk1-Jul-03 4:29 

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.