From: RB on
Thanks David I will try this.


From: RB on
> So I put the versioninfo in the .rc2 file (to stop appstudio from buggering it about)

Hi again David, I kinda dumb on rc files. I understand what you are
doing in the header file, but I need a little help on the rc context.
First off do I delete the data that is in my original (ResourceView) rc file?

And then I am confused as to what I actually put in the rc2 file ?

>VS_VERSION_INFO VERSIONINFO
> FILEVERSION VERMAJ,VERMIN,VERFIX,BUILDNUMBER
> PRODUCTVERSION VERMAJ,VERMIN,VERFIX,BUILDNUMBER
>....
> VALUE "FileVersion", VERSIONSTRING
> VALUE "ProductVersion", PRODUCTSTRING
>....


From: RB on
Ok been reading and experimenting and I am beginning to see some of
what you meant. I have the below done. First I cut this out of my old
rc file (by opening it up in Notepad) and then pasted it into the rc2 file

/////////in my rc2 file///////////////////////////////////
// Add manually edited resources here...
#include "AppVer.h"

#ifndef _MAC
VS_VERSION_INFO VERSIONINFO
//----- used to be FILEVERSION 1,0,0,1 -----//
FILEVERSION VERMAJ,VERMIN,VERFIX, BUILDNUMBER // edited
PRODUCTVERSION VERMAJ,VERMIN,VERFIX, BUILDNUMBER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L

#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "FileHandling MFC Application\0"
VALUE "FileVersion", VERSIONSTRING"\0" // edited
VALUE "InternalName", "FileHandling\0"
VALUE "LegalCopyright", "Copyright (C) 2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "FileHandling.EXE\0"
VALUE "ProductName", "FileHandling Application\0"
VALUE "ProductVersion", VERSIONSTRING"\0" // edited
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
//////////==== then I put this in my AppVer.h file =============//

#define _STR(x) #x
#define STR(x) _STR(x)

#define VERMAJ 1
#define VERMIN 0
#define VERFIX 0
#define BUILDNUMBER 1

#define VERMAJSTR STR( VERMAJ )
#define VERMINSTR STR( VERMIN )
#define VERFIXSTR STR( VERFIX )
#define BUILDSTR STR( BUILDNUMBER )
#define VERSIONSTRING VERMAJSTR "." VERMINSTR "." VERFIXSTR "." BUILDSTR
#define PRODUCTSTRING VERMAJSTR "." VERMINSTR "." VERFIXSTR "." BUILDSTR
// =====However I guess now I have to set the window text in the Static
// control to get all of this to show up


From: David Webber on
From: "RB" <NoMail(a)NoSpam>

> Ok been reading and experimenting and I am beginning to see some of
> what you meant. I have the below done. First I cut this out of my old
> rc file (by opening it up in Notepad) and then pasted it into the rc2 file

That's the idea: but you can also do it in Visual Studio by right clicking
in the rc2 file in the "solution view" and choosing "Open with ..." to open
the file in a normal editing window.

(But be careful editing standard .rc files like that as it is possible to do
things APPSTUDIO doesn't like.)

> /////////in my rc2 file///////////////////////////////////
>....

That's the general idea.

// =====However I guess now I have to set the window text in the Static
> // control to get all of this to show up

Exactly. Something like:

CString s;
s.Format( _T("This is my program version %d.%d.%d.%d"), VERMAJ, VERMIN,
VERFIX, BUILDNUMBER );
m_wnd.SetWindowText( s );

Dave
David Webber
Mozart Music Software
http://www.mozart.co.uk
For discussion and support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

From: RB on

Yea, I was using another format function but having problems with an
assertion, so I tried your CString method. But I am still getting the
assertion, I must not be calling it correctly. I first tried it in the
dialog constructor, and got the assertion.
So then I tried it in the handler that calls the dialog, but got
the same assertion. I am foo barring somewhere.
Code below.

//// CAboutDlg dialog used for App About
//
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CStatic m_CtrlStaticCr;
CStatic m_CtrlStaticVer;
//}}AFX_DATA
//............
}

//// DDX Stuff
//
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_STATICcr, m_CtrlStaticCr);
DDX_Control(pDX, IDC_STATICver, m_CtrlStaticVer);
//}}AFX_DATA_MAP
}

//// handler that runs the dialog
//
void CFileHandlingApp::OnAppAbout()
{
CAboutDlg aboutDlg;
CString s;
s.Format( _T(" version %d.%d.%d.%d"), VERMAJ, VERMIN, VERFIX, BUILDNUMBER );
aboutDlg.m_CtrlStaticVer.SetWindowText(s); //gets a Debug Assertion Failed
aboutDlg.DoModal();
}