[Code Sample] Retrieve C++ Application Version from VS_VERSION Resource

Sometimes you may need to retrieve the application version from its own resources. While sounding trivial, this task is not so easy to solve. While you can easily access string resources or dialog resources using the dedicated WinAPI functions, the version resource retrieval is not so easy. That's because the corresponding function VerQueryValue is intended for retrieving versions from another loaded module, not from own executable. So, how would you retrieve the application version from your own executable then?