資源簡介
VC++ 獲得文件屬性
獲取文件的創建時間、修改時間、訪問時間以及是否是只讀、存檔、隱藏、系統等屬性。
獲取文件的創建時間、修改時間、訪問時間以及是否是只讀、存檔、隱藏、系統等屬性。
代碼片段和文件信息
/*
?Written?by?Steve?Bryndin?(fishbed@tezcat.com?steveb@gvsi.com).
?This?code?may?be?used?in?compiled?form?in?any?way?you?wish.?This
?file?may?be?redistributed?unmodified?by?any?means?PROVIDING?it?is?
?not?sold?for?profit?without?the?authors?written?consent?and?
?providing?that?this?notice?and?the?authors?name?is?included.?
?An?email?letting?me?know?that?you?are?using?it?would?be?
?nice?as?well.?
?This?software?is?provided?“as?is“?without?express?or?implied?warranty.?
?Use?it?at?you?own?risk!?The?author?accepts?no?liability?for?any?damages?
?to?your?computer?or?data?these?products?may?cause.
*/
//?ExecImageVersion.cpp:?implementation?of?the?CExecImageVersion?class.
//?Download?by?http://www.codefans.net
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“ExecImageVersion.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CExecImageVersion::CExecImageVersion()
{
m_strImage?=?AfxGetAppName();
m_strImage?+=?“.exe“;
m_lpszImageName?=?m_strImage.GetBuffer(sizeof(m_strImage));
InitVer();
}
CExecImageVersion::CExecImageVersion(LPTSTR?lpszImageName)
{
m_lpszImageName?=?lpszImageName;
InitVer();
}
CExecImageVersion::~CExecImageVersion()
{
free(m_lpBuffer);
}
//產品名稱
CString?CExecImageVersion::GetProductName()
{
CString strProduct;
//Use?the?version?information?block?to?obtain?the?product?name.
::VerQueryValue(m_lpBuffer
????????????TEXT(“\\StringFileInfo\\040904B0\\ProductName“)
&m_lpData
&m_uiDataSize);
strProduct.Format(“%s“?m_lpData);
return?strProduct;
}
//產品版本信息
CString?CExecImageVersion::GetProductVersion()
{
CString strProductVer;
//Use?the?version?information?block?to?obtain?the?product?name.
::VerQueryValue(m_lpBuffer
????????????TEXT(“\\StringFileInfo\\040904B0\\ProductVersion“)
&m_lpData
&m_uiDataSize);
strProductVer.Format(“%s“?m_lpData);
return?strProductVer;
}
//公司名稱
CString?CExecImageVersion::GetCompanyName()
{
CString strCompany;
//Use?the?version?information?block?to?obtain?the?product?name.
::VerQueryValue(m_lpBuffer
????????????TEXT(“\\StringFileInfo\\040904B0\\CompanyName“)
&m_lpData
&m_uiDataSize);
strCompany.Format(“%s“?m_lpData);
return?strCompany;
}
//合法版權
CString?CExecImageVersion::GetCopyright()
{
CString strCopy;
//Use?the?version?information?block?to?obtain?the?product?name.
::VerQueryValue(m_lpBuffer
????????????TEXT(“\\StringFileInfo\\040904B0\\LegalCopyright“)
&m_lpData
&m_uiDataSize);
strCopy.Format(“%s“?m_lpData);
return?strCopy;
}
CString?CExecImageVersion::GetComments()
{
CString strComments;
//Use?the?version?information?block?to?obtain?t
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
????????????????75575????????????????????21
- 上一篇:網上拍賣系統完整源代碼
- 下一篇:介紹幾種壓縮算法及《笨笨數據壓縮教程》
評論
共有 條評論