cryptui: Disable some buttons if a certificate is not selected.

This commit is contained in:
Alexander Morozov 2011-08-08 19:39:07 +04:00 committed by Alexandre Julliard
parent 20d7bc9522
commit 4b6b0fe681
1 changed files with 11 additions and 12 deletions

View File

@ -1164,20 +1164,19 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
break;
case LVN_ITEMCHANGED:
{
NMITEMACTIVATE *nm;
WCHAR empty[] = { 0 };
NMITEMACTIVATE *nm = (NMITEMACTIVATE*)lp;
HWND lv = GetDlgItem(hwnd, IDC_MGR_CERTS);
int numSelected = SendMessageW(lv, LVM_GETSELECTEDCOUNT, 0, 0);
nm = (NMITEMACTIVATE*)lp;
if (nm->uNewState & LVN_ITEMACTIVATE)
{
int numSelected = SendMessageW(lv, LVM_GETSELECTEDCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_MGR_EXPORT), numSelected > 0);
EnableWindow(GetDlgItem(hwnd, IDC_MGR_REMOVE), numSelected > 0);
EnableWindow(GetDlgItem(hwnd, IDC_MGR_VIEW), numSelected == 1);
if (numSelected == 1)
cert_mgr_show_cert_usages(hwnd, nm->iItem);
}
EnableWindow(GetDlgItem(hwnd, IDC_MGR_EXPORT), numSelected > 0);
EnableWindow(GetDlgItem(hwnd, IDC_MGR_REMOVE), numSelected > 0);
EnableWindow(GetDlgItem(hwnd, IDC_MGR_VIEW), numSelected == 1);
if (numSelected == 1)
cert_mgr_show_cert_usages(hwnd, nm->iItem);
else
SendMessageW(GetDlgItem(hwnd, IDC_MGR_PURPOSES), WM_SETTEXT, 0,
(LPARAM)empty);
break;
}
case NM_DBLCLK: