Hello:

I would like to add the date my EXE file was built (i.e. created) to the
About box.

I thought I had it solved with the code snippet at the end of this e-mail,
but I just found out today that it does not work on Windows 98. Namely, the
call to FindFile() returns FALSE;

Any ideas.

TIA.

Michael


CString CMyApp::GetExecutableDateStamp(strWorkingDir)
{
CString strError = "";
CString strFile = "";
CString strMsg;
FileFind fileFind;

strFile.Format("%s\\AB2000.exe", strWorkingDir);
if(!fileFind.FindFile(strFile))
{
strFile.Format("%s\\Release\\MyApp.exe", m_strWorkingDir);
if(!fileFind.FindFile(strFile))
{
strMsg.Format("%s\n\n%s\n\n%s", "Problem getting the date-stamp
for MyApp.",
"Unable to access the file at:", strFile);
AfxMessageBox(strMsg);
return strError;
}
}

CFile appFile(strFile, 0);
CFileStatus status;
VERIFY(appFile.GetStatus(status));
CString strDateStamp;
strDateStamp.Format("%d-%d-%d %02d:%02d",
status.m_mtime.GetMonth(),
status.m_mtime.GetDay(),
status.m_mtime.GetYear(),
status.m_mtime.GetHour(),
status.m_mtime.GetMinute());

return strDateStamp;
}

Re: How to retrieve an executable's build date? by tom_usenet

tom_usenet
Thu Nov 20 06:51:10 CST 2003

On Wed, 19 Nov 2003 17:21:26 -0800, "Michael Thal"
<mthal4@nospam-att.net> wrote:

>Hello:
>
>I would like to add the date my EXE file was built (i.e. created) to the
>About box.
>
>I thought I had it solved with the code snippet at the end of this e-mail,
>but I just found out today that it does not work on Windows 98. Namely, the
>call to FindFile() returns FALSE;
>
>Any ideas.

Use the standard C macro __DATE__ (no header required). This gives the
date on which the file was compiled, so just make sure the file in
question is rebuilt when you make the .exe.

Tom

Re: How to retrieve an executable's build date? by Mike

Mike
Thu Nov 20 09:04:01 CST 2003

Hi Michael,

I have found the best method to be to use the version.lib methods.

This has enabled me to integrate automated versioning
with every build. Automagically, updating build date
and bumping revisions as needed.

Then i can use the version API to get all the info I need
at runtime. I never have to statically change any dialog
boxes.

~mike


"Michael Thal" <mthal4@nospam-att.net> wrote in
news:utYOeSwrDHA.560@TK2MSFTNGP11.phx.gbl:

> Hello:
>
> I would like to add the date my EXE file was built (i.e. created) to
> the About box.
>
> I thought I had it solved with the code snippet at the end of this
> e-mail, but I just found out today that it does not work on Windows
> 98. Namely, the call to FindFile() returns FALSE;
>
> Any ideas.
>
> TIA.
>
> Michael
>
>
> CString CMyApp::GetExecutableDateStamp(strWorkingDir)
> {
> CString strError = "";
> CString strFile = "";
> CString strMsg;
> FileFind fileFind;
>
> strFile.Format("%s\\AB2000.exe", strWorkingDir);
> if(!fileFind.FindFile(strFile))
> {
> strFile.Format("%s\\Release\\MyApp.exe", m_strWorkingDir);
> if(!fileFind.FindFile(strFile))
> {
> strMsg.Format("%s\n\n%s\n\n%s", "Problem getting the
> date-stamp
> for MyApp.",
> "Unable to access the file at:", strFile);
> AfxMessageBox(strMsg);
> return strError;
> }
> }
>
> CFile appFile(strFile, 0);
> CFileStatus status;
> VERIFY(appFile.GetStatus(status));
> CString strDateStamp;
> strDateStamp.Format("%d-%d-%d %02d:%02d",
> status.m_mtime.GetMonth(),
> status.m_mtime.GetDay(),
> status.m_mtime.GetYear(),
> status.m_mtime.GetHour(),
> status.m_mtime.GetMinute());
>
> return strDateStamp;
> }
>
>
>



--
Mike Pulice
http://www.puliceworx.com