- Add icons for user, locked user and group.

- Enable users to change their name and password (not fully working yet).
- Use the IDI_ prefix for icons.

svn path=/trunk/; revision=30958
This commit is contained in:
Eric Kohl 2007-12-02 14:35:59 +00:00
parent 7646664619
commit 626e85df7f
10 changed files with 198 additions and 14 deletions

View file

@ -12,7 +12,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Users"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
7, 7, 238, 85, WS_EX_CLIENTEDGE
END
@ -22,7 +22,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Groups"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
7, 7, 238, 85, WS_EX_CLIENTEDGE
END
@ -36,6 +36,31 @@ BEGIN
END
IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223
STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "General"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", IDC_USER_NAME, 7, 7, 112, 8
END
IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74
STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Password"
FONT 8, "MS Shell Dlg"
BEGIN
EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL
RTEXT "New Password:", -1,7,10,96,8
EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL
RTEXT "Repeat Password:", -1,7,28,96,8
DEFPUSHBUTTON "OK",IDOK,156,53,50,14
PUSHBUTTON "Abbrechen",IDCANCEL,210,53,50,14
END
/* Menus */
IDM_POPUP_GROUP MENU DISCARDABLE

View file

@ -13,10 +13,14 @@
#define ICONSIZE 16
/* ids */
#define IDC_USRMGR_ICON 40
#define IDC_USRMGR_ICON2 100 // Needed for theme compatability with Windows.
/* Icons */
#define IDI_USRMGR_ICON 40
#define IDI_USRMGR_ICON2 100 // Needed for theme compatibility with Windows.
#define IDI_USER 41
#define IDI_LOCKED_USER 42
#define IDI_GROUP 43
#define IDD_USERS 100
#define IDD_GROUPS 101
@ -29,6 +33,26 @@
#define IDC_STATIC -1
/* Dialogs */
#define IDD_USER_GENERAL 310
#define IDC_USER_NAME 311
#define IDC_USER_FULLNAME 312
#define IDC_USER_DESCRIPTION 313
#define IDC_USER_PW_CHANGE 314
#define IDC_USER_PW_NOCHANGE 315
#define IDC_USER_PW_EXPIRE 316
#define IDC_USER_DEACTIVATE 317
#define IDC_USER_LOCK 318
#define IDD_CHANGE_PASSWORD 350
#define IDC_EDIT_PASSWORD1 351
#define IDC_EDIT_PASSWORD2 352
/* Strings */
#define IDS_CPLNAME 2000
#define IDS_CPLDESCRIPTION 2001
@ -36,7 +60,9 @@
#define IDS_FULLNAME 2101
#define IDS_DESCRIPTION 2102
/* Menus */
#define IDM_POPUP_GROUP 120
#define IDM_GROUP_ADD_MEMBER 121
#define IDM_GROUP_NEW 122

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -20,6 +20,69 @@ typedef struct _USER_DATA
} USER_DATA, *PUSER_DATA;
static BOOL
SetPassword(HWND hwndDlg)
{
TCHAR szPassword1[256];
TCHAR szPassword2[256];
UINT uLen1;
UINT uLen2;
uLen1 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD1, szPassword1, 256);
uLen2 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD2, szPassword2, 256);
/* Check the passwords */
if (uLen1 != uLen2 || _tcscmp(szPassword1, szPassword2) != 0)
{
MessageBox(hwndDlg,
TEXT("The passwords you entered are not the same!"),
TEXT("ERROR"),
MB_OK | MB_ICONERROR);
return FALSE;
}
return TRUE;
}
INT_PTR CALLBACK
ChangePasswordDlgProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
UNREFERENCED_PARAMETER(wParam);
switch (uMsg)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
if (SetPassword(hwndDlg))
EndDialog(hwndDlg, 0);
break;
case IDCANCEL:
EndDialog(hwndDlg, 0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
static VOID
SetUsersListColumns(HWND hwndListView)
{
@ -120,7 +183,46 @@ OnInitDialog(HWND hwndDlg)
}
static VOID
static BOOL
OnEndLabelEdit(LPNMLVDISPINFO pnmv)
{
TCHAR szOldUserName[UNLEN];
TCHAR szNewUserName[UNLEN];
USER_INFO_0 useri0;
NET_API_STATUS status;
if (pnmv->item.iItem == -1)
return FALSE;
ListView_GetItemText(pnmv->hdr.hwndFrom,
pnmv->item.iItem, 0,
szOldUserName,
UNLEN);
lstrcpy(szNewUserName, pnmv->item.pszText);
if (lstrcmp(szOldUserName, szNewUserName) == 0)
return FALSE;
useri0.usri0_name = szNewUserName;
status = NetUserSetInfo(NULL, szOldUserName, 0, (LPBYTE)&useri0, NULL);
if (status != NERR_Success)
{
TCHAR szText[256];
wsprintf(szText, _T("Error: %u"), status);
MessageBox(NULL, szText, _T("NetUserSetInfo"), MB_ICONERROR | MB_OK);
return FALSE;
}
ListView_SetItemText(pnmv->hdr.hwndFrom,
pnmv->item.iItem, 0,
szNewUserName);
return TRUE;
}
static BOOL
OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
{
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
@ -143,6 +245,9 @@ OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
case NM_DBLCLK:
break;
case LVN_ENDLABELEDIT:
return OnEndLabelEdit((LPNMLVDISPINFO)phdr);
case NM_RCLICK:
ClientToScreen(GetDlgItem(hwndDlg, IDC_USERS_LIST), &lpnmlv->ptAction);
TrackPopupMenu(GetSubMenu(pUserData->hPopupMenu, (lpnmlv->iItem == -1) ? 0 : 1),
@ -151,6 +256,8 @@ OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
}
break;
}
return FALSE;
}
@ -180,6 +287,28 @@ UsersPageProc(HWND hwndDlg,
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDM_USER_CHANGE_PASSWORD:
DialogBoxParam(hApplet,
MAKEINTRESOURCE(IDD_CHANGE_PASSWORD),
hwndDlg,
ChangePasswordDlgProc,
(LPARAM)NULL);
break;
case IDM_USER_RENAME:
{
INT nItem;
HWND hwndLV;
hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST);
nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
if (nItem != -1)
{
(void)ListView_EditLabel(hwndLV, nItem);
}
}
break;
case IDM_USER_PROPERTIES:
MessageBeep(-1);
break;
@ -187,8 +316,7 @@ UsersPageProc(HWND hwndDlg,
break;
case WM_NOTIFY:
OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);
break;
return OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);
case WM_DESTROY:
DestroyMenu(pUserData->hPopupMenu);

View file

@ -20,7 +20,7 @@ HINSTANCE hApplet = 0;
APPLET Applets[NUM_APPLETS] =
{
{
IDC_USRMGR_ICON,
IDI_USRMGR_ICON,
IDS_CPLNAME,
IDS_CPLDESCRIPTION,
UsrmgrApplet
@ -60,7 +60,7 @@ UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
psh.dwFlags = PSH_PROPSHEETPAGE;
psh.hwndParent = NULL;
psh.hInstance = hApplet;
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_USRMGR_ICON));
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_USRMGR_ICON));
psh.pszCaption = Caption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;

View file

@ -5,6 +5,7 @@
<include base="usrmgr">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x609</define>
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>

View file

@ -11,7 +11,11 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
123 24 DISCARDABLE "manifest.xml"
IDC_USRMGR_ICON ICON "resources/applet.ico"
IDC_USRMGR_ICON2 ICON "resources/applet.ico"
IDI_USRMGR_ICON ICON "resources/applet.ico"
IDI_USRMGR_ICON2 ICON "resources/applet.ico"
IDI_USER ICON "resources/user.ico"
IDI_LOCKED_USER ICON "resources/locked.ico"
IDI_GROUP ICON "resources/group.ico"
#include "rsrc.rc"