From: Giovanni Dicanio on
On 14/06/2010 17:43, Joseph M. Newcomer wrote:

> CWindow is the ATL class
>
> CWindow is a stripped-down lightweight class for use in ActiveX controls (primarily in
> ActiveVIrus controls, those controls whose purpose in life is to be blocked by
> intelligently-configured browsers)

You can use CWindow to wrap any HWND's.
ATL was originally designed to build lightweight (quickly downloadable
from the web, and not requiring MFC DLL's) ActiveX controls, but then it
evolved in a small and fast template-based library for Win32 and COM
programming.

Giovanni

From: RB on
Corrective update, although the paste I gave you does in fact work
in my App currently. You may want to reexamine my use of the
results of
#define _STR(x) #x
#define STR(x) _STR(x)
since I am still learning this area, and some reading I did last night
proves to me that I did not fully understand what this macro was
expanding to when I implemented some of the pasted code.

I really should not be replying to questions since I am not at that
level of competence yet. I only supplied it since I "appeared at the
time" to have a working example of what you asked for, which
the whole idea was given to me ( if you followed the thread )
by David Webber, but the implementation (and any foo bars )
are my doing, not Davids.
So use what you will but be aware.
RB
From: Joseph M. Newcomer on
The idea is that the header file is used to create both the string in the About box and
the values in the .rc file that describes the VERSIONINFO.
joe

On Mon, 14 Jun 2010 18:54:46 -0500, "JCO" <someone(a)somewhere.com> wrote:

>I think I'm missing something but I'm interested in this topic.
>If you have your version defined in a header file, then you can display it
>in the dialog, however, if you did a "property" on the exe file, has it
>really changed? If so, then I got lost somewhere in this thread.
>
>Also;
>I was under the impression that you can set something in VS that allowed the
>version to change each time you do a build. I don't remember how to do this
>but I always thought this was possible. Now it may only change the Build
>number and not anything else, however, this is a good feature. Is this
>still possible, if so .... how do you do it?
>
>Thanks
>
>
>"Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message
>news:eg3hiCyCLHA.2012(a)TK2MSFTNGP02.phx.gbl...
>> On 13/06/2010 15:47, RB wrote:
>>
>>> 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();
>>
>> You may want to add a method to your CAboutDlg class like
>> SetVersionString(LPCTSTR pszVersion) and a data member of type CString
>> (e.g. CString m_strVersion).
>> This new method should set the version string, storing it into the proper
>> data member.
>>
>> Then, CAboutDlg::OnInitDialog would get this string and .SetWindowText()
>> it in the proper static control.
>>
>> e.g.:
>>
>> class CAboutDlg
>> {
>> ...
>> public:
>> void SetVersionString(LPCTSTR pszVersion)
>> {
>> m_strVersion = pszVersion;
>> }
>>
>> ...
>>
>> private:
>> CString m_strVersion;
>> };
>>
>> In CAboudDlg::OnInitDialog() do:
>>
>> m_CtrlStaticVer.SetWindowText(m_strVersion);
>>
>>
>> Giovanni
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on
See below...
On Mon, 14 Jun 2010 22:09:09 -0400, "RB" <NoMail(a)NoSpam> wrote:

>
>"JCO" wrote
>>I think I'm missing something but I'm interested in this topic.
>> If you have your version defined in a header file, then you can display it
>> in the dialog, however, if you did a "property" on the exe file, has it
>> really changed? If so, then I got lost somewhere in this thread.
>
>Well I think I can show you that part since it does work on my
>App. See code at bottom.
>
>> Also;
>> I was under the impression that you can set something in VS that allowed the
>> version to change each time you do a build. I don't remember how to do this
>> but I always thought this was possible. Now it may only change the Build
>> number and not anything else, however, this is a good feature. Is this
>> still possible, if so .... how do you do it?
****
This has been a gross oversight which I first complained about in the early 1990s, and
Microsoft has done NOTHING to provide a build-number incrementer (although it would be
easy enough to do as an integrated component of VS). I wrote my own build number
incrementer some years ago and you can find it on my MVP Tips site. We still don't have
it in VS2010, which means it has been something they have been aware of for over 15 years
and have still done NOTHING to fix, in spite of the demand of users.
joe
****
>
>I will let Giovanni respond to that since I am used to using an old version
>of VS that does not (that I am aware of ) do this.
>
>----pasted pertinant code to version going to Exe (and any DLLs) on build
>I put the below into my AppVer.h file. This is the one source for version data.
>Include this file in each file that needs access to version data
>
>// Stringisation.
>// (Two steps needed).
>
>#define _STR(x) #x
>#define STR(x) _STR(x)
>
>// The following are used as defined quantities
>// in the versioninfo resource:
>
>#define VERMAJ 1
>#define VERMIN 0
>#define VERFIX 0
>#define BUILDNUMBER 0
>
>#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
>
>#define CORP_NAME "RBC" // used in file serialize data
>#define CPY_RIGHT_YR "Copyright (C) 2010" // used in CAbout dialog
> // along with VERSIONSTRING
>
>----Now as to the Exe properties part, what I did was look in my AppWizard
>generated rc file, and cut out the CAbout dialog defined section, and then paste
>it into rc2 file, i.e.
>
>/////////in my rc2 file///////////////////////////////////
>// Add manually edited resources here...
>
>#include "AppVer.h" // this is the one version source
>
>// From here down was cut out of Project rc file and then pasted here
>// and then edited to receive the defines from the AppVer.h file
>// See edits below
>
>#ifndef _MAC
>
>VS_VERSION_INFO VERSIONINFO
>//--in the original rc file section this used to be
>// FILEVERSION 1,0,0,1 --//
> FILEVERSION VERMAJ,VERMIN,VERFIX, BUILDNUMBER
> 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", CORP_NAME "\0" //*EDITED
> VALUE "FileDescription", "FileHandling MFC Application\0"
> VALUE "FileVersion", VERSIONSTRING "\0" //*EDITED
> VALUE "InternalName", "FileHandling\0"
> VALUE "LegalCopyright", CPY_RIGHT_YR "\0" //*EDITED
> VALUE "LegalTrademarks", "\0"
> VALUE "OriginalFilename", "FileHandling.EXE\0"
> VALUE "ProductName", "FileHandling Application\0"
> VALUE "ProductVersion", PRODUCTSTRING "\0" //*EDITED
> END
> END
> BLOCK "VarFileInfo"
> BEGIN
> VALUE "Translation", 0x409, 1200
> END
>END
>#endif // !_MAC
>
>---The above will show in the properties when you right click on exe.
>Note I had to leave a space between the DEFINE and the NULL
>i.e. VERSIONSTRING "\0" and not VERSIONSTRING"\0"
>or I got a " in the output. I choose to keep the "\0" separate from the
>#defines since I used some of them later for sting literal initalizers.
>Otherwise I guess you could include it in the define.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: JCO on
When I add this information to the RC2 file, I get these two errors:
1 CVT1100: duplicate resource, Type:VERSION, name:1, language:0x0409
2 LNK1123: failure during conversion to COFF: file invalid or corrupt

"RB" <NoMail(a)NoSpam> wrote in message
news:umG$MhIDLHA.4400(a)TK2MSFTNGP05.phx.gbl...
> Corrective update, although the paste I gave you does in fact work
> in my App currently. You may want to reexamine my use of the
> results of #define _STR(x) #x
> #define STR(x) _STR(x)
> since I am still learning this area, and some reading I did last night
> proves to me that I did not fully understand what this macro was
> expanding to when I implemented some of the pasted code.
>
> I really should not be replying to questions since I am not at that
> level of competence yet. I only supplied it since I "appeared at the
> time" to have a working example of what you asked for, which
> the whole idea was given to me ( if you followed the thread )
> by David Webber, but the implementation (and any foo bars )
> are my doing, not Davids.
> So use what you will but be aware.
> RB