Get Application Version from Resources

David Aaronson 21 Reputation points

Hi everybody!

I need to display my WinAPI application name and version on the main window.

Like: MyApp

Now I just saving this info in the cpp file and also in the VS_VERSION resource. I was thinking if only I could save it in one place? Maybe I could do some defines that will extract the info from resources? I saw similar questions here but no clear answer. Thanks.

Best regards,

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,061 questions
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,882 questions
0 comments No comments
{count} votes

Accepted answer
  1. Artemiy Moroz 266 Reputation points

    As @David Lowndes mentioned here, to query the version from a resource one should use VerQueryValue API.
    But unfortunately, this API does not support resource IDs directly, moreover, it does modifications to loaded resource's memory. So one should load the resource with LoadResource and then copy it to writable memory. I found a code sample for this: Retrieve the application version from its own resources

    Hope this helps.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. David Lowndes 4,636 Reputation points

    The key API to use to get a string from the version resource is VerQueryValue

    0 comments No comments