Click here to Skip to main content
14,241,538 members

C / C++ / MFC

 
AnswerRe: Where I can learn about using wsprintf? Pin
Richard MacCutchan26-Jul-18 22:13
protectorRichard MacCutchan26-Jul-18 22:13 
QuestionReturn nothing from a function having return type Pin
meerokh26-Jul-18 0:40
membermeerokh26-Jul-18 0:40 
AnswerRe: Return nothing from a function having return type Pin
Richard MacCutchan26-Jul-18 1:28
protectorRichard MacCutchan26-Jul-18 1:28 
GeneralRe: Return nothing from a function having return type Pin
Member 1392860827-Jul-18 11:43
memberMember 1392860827-Jul-18 11:43 
GeneralRe: Return nothing from a function having return type Pin
Richard MacCutchan27-Jul-18 21:54
protectorRichard MacCutchan27-Jul-18 21:54 
AnswerRe: Return nothing from a function having return type Pin
Jochen Arndt26-Jul-18 1:48
mveJochen Arndt26-Jul-18 1:48 
AnswerRe: Return nothing from a function having return type Pin
Joe Woodbury26-Jul-18 5:44
professionalJoe Woodbury26-Jul-18 5:44 
QuestionNo Errors but wrong values on return? Pin
GESY25-Jul-18 16:02
memberGESY25-Jul-18 16:02 
I trying to get the Version of the ComCtl32.dll library, according to what I had read
the version number for the ony on System 32 is 5.82 for legacy.

This is the code I have created, and cant get any close to that, you will see extra
lines of code for testing purposes, I maybe not even doing right the creation of the
string for the dialog box, check it out please teach me /give some tips why I get wrong values.

The Code ( Noticed the return 1 or 0 in case of no or errors ) and 1000 of thanks in advance.

char NFILE[255]; DWORD dwSize, dwHandle = 0; VS_FIXEDFILEINFO * pvi;

// Set the Path and file name
strcpy(NFILE,"C:\\Windows\\System32\\ComCtl32.dll");
MessageBox(hWndMain,NFILE,"",MB_OK); // Testing

// Check if we can reach the library.
if(LoadLibrary(NFILE)==NULL) return 1; // If NULL there is an error

// Check if Version info can retrieve and returns the size, in bytes, of that information.
dwSize = GetFileVersionInfoSize( NFILE, NULL ); // Link the Version.lib Library first
if(dwSize==0) MessageBox(hwnd,"Error","",MB_OK); // 0 means an Error

// Get the file Information
char *FDBUF = new char[dwSize];
if ( !GetFileVersionInfo( NFILE, dwHandle, dwSize, &FDBUF[ 0 ] ) )
{ delete FDBUF; return 1; } // If not true, delete the buffer and return

// Get the information into the VS_FIXEDFILEINFO Structure
dwSize = sizeof(VS_FIXEDFILEINFO);
if ( !VerQueryValue( & FDBUF[ 0 ], "\\", (LPVOID*)&pvi, (unsigned int*)&dwSize ) )
{ delete FDBUF; return 1; } // Error processing the information structure.

// Original values according to windows File Version is 5.82 on System32 for legacy
// The 6.0 version lives in %SystemRoot%\winsxs.

wsprintf(BUFF, "Version is %d",LOBYTE(LOWORD(pvi->dwProductVersionLS)),HIBYTE(LOWORD(pvi->dwProductVersionMS)));

MessageBox(hwnd,BUFF,"The Value",MB_OK); // Display the value

delete FDBUF; return 0;
AnswerRe: No Errors but wrong values on return? Pin
Victor Nijegorodov25-Jul-18 20:52
memberVictor Nijegorodov25-Jul-18 20:52 
GeneralRe: No Errors but wrong values on return? Pin
GESY26-Jul-18 7:58
memberGESY26-Jul-18 7:58 
GeneralRe: No Errors but wrong values on return? Pin
Victor Nijegorodov26-Jul-18 8:20
memberVictor Nijegorodov26-Jul-18 8:20 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 3:55
memberGESY27-Jul-18 3:55 
GeneralMessage Closed Pin
11-Dec-18 9:03
memberMember 1408587711-Dec-18 9:03 
AnswerRe: No Errors but wrong values on return? Pin
Richard MacCutchan25-Jul-18 23:42
protectorRichard MacCutchan25-Jul-18 23:42 
GeneralRe: No Errors but wrong values on return? Pin
GESY26-Jul-18 7:56
memberGESY26-Jul-18 7:56 
QuestionRe: No Errors but wrong values on return? Pin
David Crow26-Jul-18 17:11
memberDavid Crow26-Jul-18 17:11 
GeneralRe: No Errors but wrong values on return? Pin
Richard MacCutchan26-Jul-18 22:08
protectorRichard MacCutchan26-Jul-18 22:08 
SuggestionRe: No Errors but wrong values on return? Pin
David Crow26-Jul-18 17:14
memberDavid Crow26-Jul-18 17:14 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:02
memberGESY27-Jul-18 4:02 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:49
memberGESY27-Jul-18 4:49 
AnswerRe: No Errors but wrong values on return? Pin
David Crow27-Jul-18 4:53
memberDavid Crow27-Jul-18 4:53 
AnswerRe: No Errors but wrong values on return? Pin
Richard MacCutchan27-Jul-18 1:13
protectorRichard MacCutchan27-Jul-18 1:13 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 3:58
memberGESY27-Jul-18 3:58 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:53
memberGESY27-Jul-18 4:53 
AnswerRe: No Errors but wrong values on return? Pin
David Crow27-Jul-18 4:57
memberDavid Crow27-Jul-18 4:57 

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.