Click here to Skip to main content
15,909,445 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Try this:

bool GetAppName(char* filename,char *appname)
{
  // Translate filename to Unicode.
  WCHAR wcFilename[1024];
  setlocale( LC_ALL, "" );
  int i = mbstowcs(wcFilename, filename, strlen(filename));
  setlocale( LC_ALL, "C" );
  wcFilename[i] = 0;

  HRESULT hr = S_OK;
  IPropertySetStorage* pStg = NULL;
  hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_DOCFILE, 0, NULL, NULL, IID_IStorage, (void**)&pStg);
  if(FAILED(hr))
  {
  hr = ::StgOpenStorageEx(wcFilename, STGM_READWRITE | STGM_TRANSACTED, STGFMT_ANY, 0, NULL, NULL, IID_IStorage, (void**)&pStg);
    if(FAILED (hr))
      return false;
  }

  /*IPropertySetStorage* pPropSet = NULL;
  hr = pStg->QueryInterface(IID_IPropertySetStorage, (void**)&pPropSet);
  if(FAILED(hr))
  {
    pStg->Release();
    return false;
  }*/

  IPropertyStorage *pPropStg = NULL;
  hr = pStg->Open(FMTID_SummaryInformation,STGM_READ|STGM_SHARE_EXCLUSIVE,&pPropStg);
  if(FAILED(hr))
  {
    pPropSet->Release();
    pStg->Release();
    return false;
  }
  
  DumpBuiltInProps(pPropStg, appname);

  pPropSet->Release();
  pStg->Release();
  return true;
}



Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?

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 
Generalprinting multiple pages spanning horizontally Pin
Member 4509901-Jul-03 4:28
Member 4509901-Jul-03 4:28 
GeneralRe: printing multiple pages spanning horizontally Pin
basementman1-Jul-03 5:05
basementman1-Jul-03 5: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.