Construct version string in About dialog at runtime

Required to match the previous commit that removed macro
substitution in resource text strings.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/425/head
Selva Nair 2021-05-18 22:27:31 -04:00
parent 56efcc6515
commit 5d209f44cb
1 changed files with 11 additions and 3 deletions

14
main.c
View File

@ -646,9 +646,17 @@ 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;
if (msg == WM_NOTIFY) { wchar_t tmp1[256], tmp2[256];
psn = (LPPSHNOTIFY) lParam; switch (msg) {
if (psn->hdr.code == (UINT) PSN_APPLY) case WM_INITDIALOG:
if (GetDlgItemText(hDlg, ID_TXT_VERSION, tmp1, _countof(tmp1))) {
_sntprintf_0(tmp2, tmp1, TEXT(PACKAGE_VERSION_RESOURCE_STR));
SetDlgItemText(hDlg, ID_TXT_VERSION, tmp2);
}
break;
case WM_NOTIFY:
psn = (LPPSHNOTIFY) lParam;
if (psn->hdr.code == (UINT) PSN_APPLY)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;