From 6c40ba9886c42abe31d437f37aadd2397af4c749 Mon Sep 17 00:00:00 2001 From: freedom Date: Wed, 6 Sep 2023 05:23:39 -0600 Subject: [PATCH] ok so now the variables do the needful --- progmgr/dialog.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/progmgr/dialog.c b/progmgr/dialog.c index 83bc611..bf8c378 100644 --- a/progmgr/dialog.c +++ b/progmgr/dialog.c @@ -32,7 +32,7 @@ WCHAR szDlgTitle[64]; \* * * */ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - GROUP grp = { + static GROUP grp = { .dwSignature = GRP_SIGNATURE, .wVersion = GRP_VERSION, .wChecksum = 0, @@ -59,6 +59,14 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM // TODO: // fix minor GDI font/region leak + // Reset the group structure + grp.dwSignature = GRP_SIGNATURE; + grp.wVersion = GRP_VERSION; + grp.wChecksum = 0; + grp.dwFlags = 0; + grp.cItems = 0; + grp.iItems = NULL; + // Set the window title LoadString(hAppInstance, IDS_DLT_GRP_NEW, szDlgTitle, ARRAYSIZE(szDlgTitle)); SetWindowText(hWndDlg, szDlgTitle); @@ -110,7 +118,6 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM break; case IDD_OK: - // Check that all the applicable fields are filled out, // and if not then set the focus to the offending field if (!(bOKEnabled = GetDlgItemText(hWndDlg, IDD_NAME, (LPWSTR)&szBuffer, ARRAYSIZE(szBuffer)))) @@ -178,13 +185,13 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM \* * * */ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - ITEM itm = { + static ITEM itm = { .szName = L"", .szExecPath = L"", .szWorkPath = L"", .dwFlags = 0, .uiHotkeyModifiers = 0, - .uiHotkeyModifiers = 0, + .uiHotkeyVirtualKey = 0, .szIconPath = L"", .iIconIndex = 0, }; @@ -197,7 +204,6 @@ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l switch (message) { - case WM_INITDIALOG: // TODO: // actually create an item and add it to the GROUP structure @@ -205,6 +211,11 @@ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l // require a valid group to be selected or else the dialog won't // let you press OK + // Reset the item structure + itm.dwFlags = 0; + itm.uiHotkeyModifiers = 0; + itm.uiHotkeyVirtualKey = 0; + // Set the window title LoadString(hAppInstance, IDS_DLT_ITEM_NEW, szDlgTitle, ARRAYSIZE(szDlgTitle)); SetWindowText(hWndDlg, szDlgTitle);