mirror of https://github.com/OpenVPN/openvpn-gui
Add OpenVPN version in 'About' page
The version of openvpn.exe found at runtime is shown on the About page. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/540/head
parent
41a92199e4
commit
be8a8cca12
14
main.c
14
main.c
|
@ -723,13 +723,25 @@ static INT_PTR CALLBACK
|
||||||
AboutDialogFunc(UNUSED HWND hDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
AboutDialogFunc(UNUSED HWND hDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPPSHNOTIFY psn;
|
LPPSHNOTIFY psn;
|
||||||
wchar_t tmp1[256], tmp2[256];
|
wchar_t tmp1[300], tmp2[300];
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
if (GetDlgItemText(hDlg, ID_TXT_VERSION, tmp1, _countof(tmp1))) {
|
if (GetDlgItemText(hDlg, ID_TXT_VERSION, tmp1, _countof(tmp1))) {
|
||||||
_sntprintf_0(tmp2, tmp1, TEXT(PACKAGE_VERSION_RESOURCE_STR));
|
_sntprintf_0(tmp2, tmp1, TEXT(PACKAGE_VERSION_RESOURCE_STR));
|
||||||
SetDlgItemText(hDlg, ID_TXT_VERSION, tmp2);
|
SetDlgItemText(hDlg, ID_TXT_VERSION, tmp2);
|
||||||
}
|
}
|
||||||
|
/* Modify the ABOUT3 line that reads as "OpenVPN ... " by
|
||||||
|
* including the version, like "OpenVPN v2.5.8 ... ".
|
||||||
|
* The logic used depends on this text starting with
|
||||||
|
* "OpenVPN", which is the case in all languages.
|
||||||
|
*/
|
||||||
|
const wchar_t *prefix = L"OpenVPN ";
|
||||||
|
if (GetDlgItemText(hDlg, ID_LTEXT_ABOUT3, tmp1, _countof(tmp1))
|
||||||
|
&& wcsbegins(tmp1, prefix))
|
||||||
|
{
|
||||||
|
_sntprintf_0(tmp2, L"%lsv%hs %ls", prefix, o.ovpn_version, tmp1 + wcslen(prefix));
|
||||||
|
SetDlgItemText(hDlg, ID_LTEXT_ABOUT3, tmp2);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
psn = (LPPSHNOTIFY) lParam;
|
psn = (LPPSHNOTIFY) lParam;
|
||||||
|
|
Loading…
Reference in New Issue