Click here to Skip to main content
15,906,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Confusion Pin
KingsGambit19-Feb-10 2:21
KingsGambit19-Feb-10 2:21 
QuestionSorting/Arranging Rect buttons [modified] Pin
shiv@nand18-Feb-10 23:41
shiv@nand18-Feb-10 23:41 
AnswerRe: Sorting/Arranging Rect buttons Pin
Rajesh R Subramanian18-Feb-10 23:43
professionalRajesh R Subramanian18-Feb-10 23:43 
QuestionHow to add "Publisher" name to Custom Add ons in IE Pin
am 200918-Feb-10 23:30
am 200918-Feb-10 23:30 
AnswerRe: How to add "Publisher" name to Custom Add ons in IE Pin
KingsGambit19-Feb-10 1:25
KingsGambit19-Feb-10 1:25 
Questionhow can change flash sms format in at commands? Pin
Le@rner18-Feb-10 20:15
Le@rner18-Feb-10 20:15 
AnswerRe: how can change flash sms format in at commands? Pin
fat_boy19-Feb-10 2:46
fat_boy19-Feb-10 2:46 
Questionfile version information is updated but product version is not Pin
learningvisualc18-Feb-10 18:10
learningvisualc18-Feb-10 18:10 
Hi all,

I am trying to update VS_VERSION info of my application using this code

VS_VERSIONINFO      *pVerInfo;
    LPBYTE              pOffsetBytes;
    VS_FIXEDFILEINFO    *pFixedInfo;
    LPCTSTR             lpszFile = _T("C:\\a.exe");
    DWORD               dwHandle,
                        dwSize,
                        dwResult = 0;

    
   dwSize = GetFileVersionInfoSize(lpszFile, &dwHandle);
    if (0 < dwSize)
    {
        LPBYTE lpBuffer = new BYTE[dwSize];
        
        if (GetFileVersionInfo(lpszFile, 0, dwSize, lpBuffer) != FALSE)
        {
	#define roundoffs(a,b,r) (((BYTE *) (b) - (BYTE *) (a) + ((r) - 1)) & ~((r) - 1))
            #define roundpos(a,b,r) (((BYTE *) (a)) + roundoffs(a,b,r))
                       
            pVerInfo = (VS_VERSIONINFO *) lpBuffer;
            pOffsetBytes = (BYTE *) &pVerInfo->szKey[_tcslen(pVerInfo->szKey) + 1];
            pFixedInfo = (VS_FIXEDFILEINFO *) roundpos(pVerInfo, pOffsetBytes, 4);

            pFixedInfo->dwFileVersionMS    = 0x11112222;
            pFixedInfo->dwFileVersionLS    = 0x33334444;
            pFixedInfo->dwProductVersionMS = 0x00030010;
	    pFixedInfo->dwProductVersionLS = 0x00000031;

	    HANDLE hResource = BeginUpdateResource(lpszFile, FALSE);
            if (NULL != hResource)
            {
                UINT uTemp;
		      
         if (VerQueryValue(lpBuffer, _T("\\StringFileInfo\\ProductName"),(LPVOID *) &lpTranslate, &uTemp) != FALSE)
         {
              if (UpdateResource(hResource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), lpTranslate->wLanguage, lpBuffer, dwSize) != FALSE)
                    {
                        if (EndUpdateResource(hResource, FALSE) == FALSE)
                            dwResult = GetLastError();
                    }
                    else
                        dwResult = GetLastError();
                }
            }
            else
                dwResult = GetLastError();
        }
        else
            dwResult = GetLastError();

        delete [] lpBuffer;
    }
    else
        dwResult = GetLastError();

    if (0 != dwResult)
		wprintf(_T("Operation was not successful.  Result = %lu\n"), dwResult);
	else
		wprintf(_T("Operation was successful."));


but my problem is that code is updating the files version info but not product info..

Can anybody what i am doing wrong or what i am missing..

thanks in advance
QuestionCDatabase error Pin
kk.tvm18-Feb-10 17:55
kk.tvm18-Feb-10 17:55 
AnswerRe: CDatabase error Pin
Game-point18-Feb-10 17:59
Game-point18-Feb-10 17:59 
GeneralRe: CDatabase error Pin
kk.tvm18-Feb-10 18:24
kk.tvm18-Feb-10 18:24 
GeneralRe: CDatabase error Pin
Game-point18-Feb-10 21:38
Game-point18-Feb-10 21:38 
QuestionRuning the MFC program in Silent Mode. Pin
mostafa_pasha18-Feb-10 13:31
mostafa_pasha18-Feb-10 13:31 
AnswerRe: Runing the MFC program in Silent Mode. Pin
David Crow18-Feb-10 15:24
David Crow18-Feb-10 15:24 
AnswerRe: Runing the MFC program in Silent Mode. Pin
Avi Berger18-Feb-10 15:44
Avi Berger18-Feb-10 15:44 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Maximilien19-Feb-10 0:35
Maximilien19-Feb-10 0:35 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Avi Berger19-Feb-10 11:50
Avi Berger19-Feb-10 11:50 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Rozis21-Feb-10 10:58
Rozis21-Feb-10 10:58 
GeneralRe: Runing the MFC program in Silent Mode. Pin
Avi Berger23-Feb-10 7:02
Avi Berger23-Feb-10 7:02 
Questioncan one use vectors of subclasses in a parameter list? Pin
genush18-Feb-10 8:42
genush18-Feb-10 8:42 
AnswerRe: can one use vectors of subclasses in a parameter list? Pin
Kevin McFarlane18-Feb-10 9:25
Kevin McFarlane18-Feb-10 9:25 
AnswerRe: can one use vectors of subclasses in a parameter list? [modified] Pin
Avi Berger18-Feb-10 10:14
Avi Berger18-Feb-10 10:14 
GeneralRe: can one use vectors of subclasses in a parameter list? Pin
genush18-Feb-10 10:35
genush18-Feb-10 10:35 
AnswerRe: can one use vectors of subclasses in a parameter list? Pin
Chris Losinger18-Feb-10 12:57
professionalChris Losinger18-Feb-10 12:57 
GeneralRe: can one use vectors of subclasses in a parameter list? Pin
Stephen Hewitt20-Feb-10 3:28
Stephen Hewitt20-Feb-10 3:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.