1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include "wingui.h"
#include "xdvi-config.h"
/*
Displays a dialog box with version information
*/
void DispVersion()
{
char szFullPath[256];
DWORD dwVerHnd;
DWORD dwVerInfoSize;
char szBuf[256];
extern HWND hWndMain;
extern HINSTANCE hInst;
GetModuleFileName(hInst, szFullPath, sizeof(szFullPath));
dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
if (dwVerInfoSize) {
/* If we were able to get the information, process it: */
HANDLE hMem;
LPVOID lpvMem;
char szGetName[256];
int cchRoot;
BOOL fRet;
UINT cchVer = 0;
LPSTR lszVer = NULL;
hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
lpvMem = GlobalLock(hMem);
GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
lstrcpy(szGetName, "\\StringFileInfo\\040904E4\\ProductVersion");
cchRoot = lstrlen(szGetName);
fRet = VerQueryValue(lpvMem, szGetName, &lszVer, &cchVer);
if (fRet && cchVer && lszVer) {
wsprintf(szBuf, "(o)windvi %s", lszVer);
}
else {
wsprintf(szBuf, "Failed to get product version number.");
}
}
else {
wsprintf(szBuf, "Failed to get version information.");
}
MessageBox(NULL, szBuf,
"Version Information", MB_APPLMODAL | MB_ICONHAND | MB_OK);
CleanExit(0);
}
|