|
-
January 26th, 2009, 07:16 AM
#1
how can i get author, comments, ... from a file ?
Hello everybody,
i want to get some informations of a file, but i did not know how i could recieve this ?!
fortunately i found how i could read the file version, what is shown at the end of this post.
but i am also interested in the other informations like
- author
- comments
- copyright
- and so on ...
currently i am not able to get these thing ....
Does anybody know how i can get these informations !?
this would be a huge help ... !
best regards ...
#50
// ** part of my source code
// ** using visual c++ 6.0
// ** in this code i have an output which 'works fine', this shows the correct version number.
// ** the 'useless output' shows some information, which i couldn't handle ?! 
// ** the 'translation' of CString strCurrFileName seems to be unusual, but i did not know an other way how i could parse from CString to LPTSTR. 
LPCSTR lpszFilePathC = strCurrFileName;
LPTSTR lpszFilePath = (LPTSTR)lpszFilePathC;
DWORD dwDummy;
DWORD dwFVISize = GetFileVersionInfoSize( lpszFilePath , &dwDummy );
LPBYTE lpVersionInfo = new BYTE[dwFVISize];
GetFileVersionInfo( lpszFilePath , 0 , dwFVISize , lpVersionInfo );
UINT uLen;
VS_FIXEDFILEINFO *lpFfi;
VerQueryValue( lpVersionInfo , _T("\\") , (LPVOID *)&lpFfi , &uLen );
/* // ** the struct entries
_VS_FIXEDFILEINFO { // vsffi
DWORD dwSignature;
DWORD dwStrucVersion;
DWORD dwFileVersionMS;
DWORD dwFileVersionLS;
DWORD dwProductVersionMS;
DWORD dwProductVersionLS;
DWORD dwFileFlagsMask;
DWORD dwFileFlags;
DWORD dwFileOS;
DWORD dwFileType;
DWORD dwFileSubtype;
DWORD dwFileDateMS;
DWORD dwFileDateLS;
} VS_FIXEDFILEINFO;
*/
/* this works fine: */
DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;
DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;
/* experiments : */
DWORD asig = lpFfi->dwSignature;
DWORD asver = lpFfi->dwStrucVersion;
DWORD apms = lpFfi->dwProductVersionMS;
DWORD apls = lpFfi->dwProductVersionLS;
DWORD atyp = lpFfi->dwFileType;
/* no memory leaks */
delete [] lpVersionInfo;
/* this works fine: */
DWORD dwLeftMost = HIWORD(dwFileVersionMS);
DWORD dwSecondLeft = LOWORD(dwFileVersionMS);
DWORD dwSecondRight = HIWORD(dwFileVersionLS);
DWORD dwRightMost = LOWORD(dwFileVersionLS);
/* experiments : */
DWORD bsig = HIWORD(asig);
DWORD csig = LOWORD(asig);
CString aasig = (CString) asig,
bbsig = (CString) bsig,
cbsig = (CString) csig;
CString WorksFine; WorksFine.Format("Version: %d.%d.%d.%d\n" , dwLeftMost, dwSecondLeft,dwSecondRight, dwRightMost );
CString UselessOutput; UselessOutput.Format("Signature = %x "
"\nStructVersion = %x \n ProductVersionMS = %x, \nProductVersionLS = %x \n FileType = %x"
"HISig = %d, LOSig = %d",
asig, asver, apms, apls, atyp, bsig, csig);
AfxMessageBox(WorksFine);
AfxMessageBox(UselessOutput);
Last edited by Raute50; January 26th, 2009 at 11:20 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|