in src/native/windows/apps/prunmgr/prunmgr.c [631:762]
INT_PTR CALLBACK __generalProperty(HWND hDlg,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
LPPSHNOTIFY lpShn;
WCHAR szBuf[SIZ_DESLEN];
switch (uMessage) {
case WM_INITDIALOG:
{
_generalPropertyHwnd = hDlg;
if (!bEnableTry)
apxCenterWindow(GetParent(hDlg), NULL);
else if (!bpropCentered)
apxCenterWindow(GetParent(hDlg), NULL);
bpropCentered = TRUE;
startPage = 0;
if (!bEnableTry)
apxCenterWindow(GetParent(hDlg), NULL);
SendMessage(GetDlgItem(hDlg, IDC_PPSGDISP), EM_LIMITTEXT, SIZ_RESMAX, 0);
SendMessage(GetDlgItem(hDlg, IDC_PPSGDESC), EM_LIMITTEXT, SIZ_DESMAX, 0);
ComboBox_AddStringW(GetDlgItem(hDlg, IDC_PPSGCMBST), START_DELAYED);
ComboBox_AddStringW(GetDlgItem(hDlg, IDC_PPSGCMBST), START_AUTO);
ComboBox_AddStringW(GetDlgItem(hDlg, IDC_PPSGCMBST), START_MANUAL);
ComboBox_AddStringW(GetDlgItem(hDlg, IDC_PPSGCMBST), START_DISABLED);
if (_currentEntry->lpConfig->dwStartType == SERVICE_AUTO_START) {
if (_currentEntry->bDelayedStart) {
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_PPSGCMBST), 0);
}
else {
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_PPSGCMBST), 1);
}
}
else if (_currentEntry->lpConfig->dwStartType == SERVICE_DEMAND_START)
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_PPSGCMBST), 2);
else if (_currentEntry->lpConfig->dwStartType == SERVICE_DISABLED)
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_PPSGCMBST), 3);
SetDlgItemTextW(hDlg, IDC_PPSGNAME, _currentEntry->szServiceName);
SetDlgItemTextW(hDlg, IDC_PPSGDISP, _currentEntry->lpConfig->lpDisplayName);
SetDlgItemTextW(hDlg, IDC_PPSGDESC, _currentEntry->szServiceDescription);
SetDlgItemTextW(hDlg, IDC_PPSGDEXE, _currentEntry->lpConfig->lpBinaryPathName);
__generalPropertyRefresh(hDlg);
}
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_PPSGCMBST:
if (HIWORD(wParam) == CBN_SELCHANGE) {
PropSheet_Changed(GetParent(hDlg), hDlg);
SET_BIT_FLAG(_propertyChanged, 1);
}
break;
case IDC_PPSGDISP:
if (HIWORD(wParam) == EN_CHANGE) {
GetDlgItemTextW(hDlg, IDC_PPSGDISP, szBuf, SIZ_RESMAX);
if (!lstrcmpW(szBuf, _currentEntry->lpConfig->lpDisplayName)) {
PropSheet_UnChanged(GetParent(hDlg), hDlg);
CLR_BIT_FLAG(_propertyChanged, 1);
}
else {
PropSheet_Changed(GetParent(hDlg), hDlg);
SET_BIT_FLAG(_propertyChanged, 1);
}
}
break;
case IDC_PPSGDESC:
if (HIWORD(wParam) == EN_CHANGE) {
GetDlgItemTextW(hDlg, IDC_PPSGDESC, szBuf, SIZ_DESMAX);
if (!lstrcmpW(szBuf, _currentEntry->szServiceDescription)) {
PropSheet_UnChanged(GetParent(hDlg), hDlg);
CLR_BIT_FLAG(_propertyChanged, 1);
}
else {
PropSheet_Changed(GetParent(hDlg), hDlg);
SET_BIT_FLAG(_propertyChanged, 1);
}
}
break;
case IDC_PPSGSTART:
apxProgressBox(hDlg, apxLoadResourceW(IDS_HSSTART, 0),
_currentEntry->lpConfig->lpDisplayName,
__startServiceCallback, NULL);
__generalPropertyRefresh(hDlg);
break;
case IDC_PPSGSTOP:
apxProgressBox(hDlg, apxLoadResourceW(IDS_HSSTOP, 0),
_currentEntry->lpConfig->lpDisplayName,
__stopServiceCallback, NULL);
__generalPropertyRefresh(hDlg);
break;
case IDC_PPSGPAUSE:
apxProgressBox(hDlg, apxLoadResourceW(IDS_HSPAUSE, 0),
_currentEntry->lpConfig->lpDisplayName,
__pauseServiceCallback, NULL);
__generalPropertyRefresh(hDlg);
break;
case IDC_PPSGRESTART:
apxProgressBox(hDlg, apxLoadResourceW(IDS_HSRESTART, 0),
_currentEntry->lpConfig->lpDisplayName,
__restartServiceCallback, NULL);
__generalPropertyRefresh(hDlg);
break;
}
break;
case WM_NOTIFY:
lpShn = (LPPSHNOTIFY )lParam;
switch (lpShn->hdr.code) {
case PSN_APPLY: /* sent when OK or Apply button pressed */
if (__generalPropertySave(hDlg)) {
PropSheet_UnChanged(GetParent(hDlg), hDlg);
}
else {
SET_BIT_FLAG(_propertyChanged, 1);
SetWindowLong(hDlg, DWLP_MSGRESULT,
PSNRET_INVALID_NOCHANGEPAGE);
return TRUE;
}
break;
default:
break;
}
break;
default:
break;
}
return FALSE;
}