mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 12:23:30 +00:00
implemented timeout settings on startup and recovery page
svn path=/trunk/; revision=24691
This commit is contained in:
@@ -165,11 +165,11 @@ BEGIN
|
||||
LTEXT "Default operating &system:", IDC_STATIC, 14, 26, 100, 8
|
||||
COMBOBOX IDC_STRECOSCOMBO, 14, 37, 224, 46, CBS_DROPDOWNLIST
|
||||
//CHECKBOX "&Time to display list of operating systems:", IDC_STRECLIST, 14, 56, 150, 8
|
||||
CONTROL "&Time to display list of operating systems:", IDC_STRECLIST, "button", BS_CHECKBOX, 14, 56, 150, 8
|
||||
CONTROL "&Time to display list of operating systems:", IDC_STRECLIST, "button", BS_AUTOCHECKBOX, 14, 56, 150, 8
|
||||
EDITTEXT IDC_STRRECLISTEDIT, 179, 54, 30, 12
|
||||
CONTROL "", IDC_STRRECLISTUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13
|
||||
LTEXT "seconds", IDC_STATIC, 215, 56, 25, 8
|
||||
CONTROL "Time to &display recovery options when needed:", IDC_STRRECREC, "button", BS_CHECKBOX, 14, 70, 163, 8
|
||||
CONTROL "Time to &display recovery options when needed:", IDC_STRRECREC, "button", BS_AUTOCHECKBOX, 14, 70, 163, 8
|
||||
EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12
|
||||
CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13
|
||||
LTEXT "seconds", IDC_STATIC, 215, 70, 25, 8
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <lm.h>
|
||||
#include <cpl.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
#include "resource.h"
|
||||
|
||||
#define NUM_APPLETS (1)
|
||||
|
||||
@@ -1,14 +1,31 @@
|
||||
|
||||
/*
|
||||
* PROJECT: ReactOS System Control Panel Applet
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: dll/cpl/sysdm/startrec.c
|
||||
* PURPOSE: Computer settings for startup and recovery
|
||||
* COPYRIGHT: Copyright 2006 Ged Murphy <[email protected]>
|
||||
* Copyright 2006 Christoph von Wittich <[email protected]>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
static TCHAR m_szFreeldrIni[MAX_PATH + 15];
|
||||
|
||||
void SetTimeout(HWND hwndDlg, int Timeout)
|
||||
{
|
||||
if (Timeout == 0)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_STRRECLISTUPDWN), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_STRRECLISTUPDWN), TRUE);
|
||||
}
|
||||
SendDlgItemMessage(hwndDlg, IDC_STRRECLISTUPDWN, UDM_SETPOS, (WPARAM) 0, (LPARAM) MAKELONG((short) Timeout, 0));
|
||||
}
|
||||
|
||||
/* Property page dialog callback */
|
||||
INT_PTR CALLBACK
|
||||
StartRecDlgProc(HWND hwndDlg,
|
||||
@@ -17,24 +34,85 @@ StartRecDlgProc(HWND hwndDlg,
|
||||
LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
TCHAR *szSystemDrive;
|
||||
TCHAR szDefaultOS[MAX_PATH];
|
||||
TCHAR szDefaultOSName[MAX_PATH];
|
||||
TCHAR szTimeout[10];
|
||||
int iTimeout;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
|
||||
/* get Path to freeldr.ini or boot.ini */
|
||||
szSystemDrive = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
|
||||
if (szSystemDrive != NULL)
|
||||
{
|
||||
szSystemDrive = _tgetenv(_T("SystemDrive"));
|
||||
if (m_szFreeldrIni != NULL)
|
||||
{
|
||||
_tcscpy(m_szFreeldrIni, szSystemDrive);
|
||||
_tcscat(m_szFreeldrIni, _T("\\freeldr.ini"));
|
||||
if (!PathFileExists(m_szFreeldrIni))
|
||||
{
|
||||
_tcscpy(m_szFreeldrIni, szSystemDrive);
|
||||
_tcscat(m_szFreeldrIni, _T("\\boot.ini"));
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, szSystemDrive);
|
||||
}
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_STRRECDUMPFILE, _T("%SystemRoot%\\MiniDump"));
|
||||
|
||||
/* load settings from freeldr.ini */
|
||||
GetPrivateProfileString(_T("boot loader"), _T("default"), NULL, szDefaultOS, MAX_PATH, m_szFreeldrIni);
|
||||
GetPrivateProfileString(_T("operating systems"), szDefaultOS, NULL, szDefaultOSName, MAX_PATH, m_szFreeldrIni);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STRECOSCOMBO, CB_ADDSTRING, (WPARAM)0, (LPARAM)szDefaultOSName);
|
||||
SendDlgItemMessage(hwndDlg, IDC_STRECOSCOMBO, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||
|
||||
/* timeout */
|
||||
iTimeout = GetPrivateProfileInt(_T("boot loader"), _T("timeout"), 0, m_szFreeldrIni);
|
||||
SetTimeout(hwndDlg, iTimeout);
|
||||
if (iTimeout != 0)
|
||||
SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
|
||||
{
|
||||
EndDialog(hwndDlg,
|
||||
LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_STRRECEDIT:
|
||||
{
|
||||
ShellExecute(0, _T("open"), _T("notepad"), m_szFreeldrIni, NULL, SW_SHOWNORMAL);
|
||||
break;
|
||||
}
|
||||
case IDOK:
|
||||
{
|
||||
/* save timeout */
|
||||
if (SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_GETCHECK, (WPARAM)0, (LPARAM)0) == BST_CHECKED)
|
||||
iTimeout = SendDlgItemMessage(hwndDlg, IDC_STRRECLISTUPDWN, UDM_GETPOS, (WPARAM)0, (LPARAM)0);
|
||||
else
|
||||
iTimeout = 0;
|
||||
_stprintf(szTimeout, _T("%i"), iTimeout);
|
||||
WritePrivateProfileString(_T("boot loader"), _T("timeout"), szTimeout, m_szFreeldrIni);
|
||||
}
|
||||
case IDCANCEL:
|
||||
{
|
||||
EndDialog(hwndDlg,
|
||||
LOWORD(wParam));
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
case IDC_STRECLIST:
|
||||
{
|
||||
if (SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_GETCHECK, (WPARAM)0, (LPARAM)0) == BST_CHECKED)
|
||||
SetTimeout(hwndDlg, 30);
|
||||
else
|
||||
SetTimeout(hwndDlg, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<library>ntdll</library>
|
||||
<library>msimg32</library>
|
||||
<library>shell32</library>
|
||||
<library>shlwapi</library>
|
||||
<file>advanced.c</file>
|
||||
<file>computer.c</file>
|
||||
<file>custclicklink.c</file>
|
||||
|
||||
Reference in New Issue
Block a user