Click here to Skip to main content
15,922,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC System Information Pin
David Crow8-Apr-05 5:07
David Crow8-Apr-05 5:07 
GeneralRe: MFC System Information Pin
charu12311-Apr-05 0:07
charu12311-Apr-05 0:07 
GeneralRe: MFC System Information Pin
David Crow11-Apr-05 2:28
David Crow11-Apr-05 2:28 
GeneralRe: MFC System Information Pin
charu12311-Apr-05 0:47
charu12311-Apr-05 0:47 
GeneralRe: MFC System Information Pin
David Crow11-Apr-05 2:42
David Crow11-Apr-05 2:42 
GeneralRe: MFC System Information Pin
charu12311-Apr-05 17:42
charu12311-Apr-05 17:42 
GeneralRe: MFC System Information Pin
charu12312-Apr-05 0:42
charu12312-Apr-05 0:42 
GeneralRe: MFC System Information Pin
David Crow12-Apr-05 2:53
David Crow12-Apr-05 2:53 
charu123 wrote:
lpData=(char*)malloc(sizeof(BUF));

I think this should be lpData=(char*)malloc(dwLen).

charu123 wrote:
sprintf (b,"MinorVersion: %d\n",LOWORD(pFileInfo->wProductVersionMS));

The compiler should have complained about this one as wProductVersionMS is not a valid member name.

Other than that, and the lack of error checking, what you have should work. You do, however, seem to be confused as to when to use MFC and when not to. Unless there is no MFC equivalent for some Win32 function, it really makes no sense to mix the two.

Here is a modified version of your code:

VS_FIXEDFILEINFO *pFileInfo;
LPCTSTR pszFile = "trial.html",
        pszPath = "C:\\Documents and Settings\\bhoomika.WIPHP_DOMAIN\\Desktop";
CString strExecutable,
        strResult;
DWORD   dwHandle, 
        dwVerSize;
LPBYTE  pBuffer;
UINT    uBufLen;
 
FindExecutable(pszFile, pszPath, strExecutable.GetBuffer(_MAX_PATH));
strExecutable.ReleaseBuffer();
 
dwVerSize = GetFileVersionInfoSize(strExecutable, &dwHandle);
if (dwVerSize > 0)
{
    pBuffer = new BYTE[dwVerSize];
    if (NULL != pBuffer)
    {
        if (GetFileVersionInfo(strExecutable, dwHandle, dwVerSize, pBuffer) != FALSE)
        {
            if (VerQueryValue(pBuffer, "\\", (LPVOID *) &pFileInfo, &uBufLen) != FALSE)
            {
                strResult.Format("MajorVersion: %u\nMinorVersion: %u", 
                    HIWORD(pFileInfo->dwProductVersionMS),
                    LOWORD(pFileInfo->dwProductVersionMS));
            }
            else
                strResult.Format("VerQueryValue() failed.  Error = %lu", GetLastError());
        }
        else
            strResult.Format("GetFileVersionInfo() failed.  Error = %lu", GetLastError());
 
        delete [] pBuffer;
    }
}
else
    strResult.Format("GetFileVersionInfoSize() failed.  Error = %lu", GetLastError());
 
AfxMessageBox(strResult);



"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralExceptions Pin
Monty27-Apr-05 20:08
Monty27-Apr-05 20:08 
GeneralRe: Exceptions Pin
Michael Dunn7-Apr-05 20:32
sitebuilderMichael Dunn7-Apr-05 20:32 
GeneralRe: Exceptions Pin
Monty27-Apr-05 20:47
Monty27-Apr-05 20:47 
GeneralRe: Exceptions Pin
Cedric Moonen7-Apr-05 22:42
Cedric Moonen7-Apr-05 22:42 
GeneralRe: Exceptions Pin
toxcct8-Apr-05 0:32
toxcct8-Apr-05 0:32 
GeneralRe: Exceptions Pin
Cedric Moonen8-Apr-05 0:45
Cedric Moonen8-Apr-05 0:45 
GeneralRe: Exceptions Pin
Kevin McFarlane7-Apr-05 23:28
Kevin McFarlane7-Apr-05 23:28 
GeneralRe: Exceptions Pin
Tim Smith8-Apr-05 4:24
Tim Smith8-Apr-05 4:24 
GeneralRe: Exceptions Pin
Kevin McFarlane8-Apr-05 8:00
Kevin McFarlane8-Apr-05 8:00 
QuestionHow to write a COM object with VC6, which can be refered in C# .NET prj? Pin
wangdave7-Apr-05 19:38
wangdave7-Apr-05 19:38 
AnswerRe: How to write a COM object with VC6, which can be refered in C# .NET prj? Pin
ThatsAlok7-Apr-05 20:02
ThatsAlok7-Apr-05 20:02 
GeneralRe: How to write a COM object with VC6, which can be refered in C# .NET prj? Pin
Anonymous20-Apr-05 15:33
Anonymous20-Apr-05 15:33 
Generalmanifest for win 2000 Pin
V.G7-Apr-05 19:26
V.G7-Apr-05 19:26 
GeneralRe: manifest for win 2000 Pin
ThatsAlok7-Apr-05 19:57
ThatsAlok7-Apr-05 19:57 
GeneralRe: manifest for win 2000 Pin
Michael Dunn7-Apr-05 20:20
sitebuilderMichael Dunn7-Apr-05 20:20 
GeneralSplitter Window Problem Pin
wasife7-Apr-05 18:26
wasife7-Apr-05 18:26 
GeneralForeign language Support Pin
AlexEvans7-Apr-05 18:10
AlexEvans7-Apr-05 18:10 

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.