- Implement devices status page

- More partly implementation

svn path=/trunk/; revision=38644
This commit is contained in:
Dmitry Chapyshev 2009-01-08 14:24:45 +00:00
parent b1bf34ac4d
commit be61701517
24 changed files with 201 additions and 5 deletions

View file

@ -32,6 +32,8 @@
HINSTANCE hApplet = NULL;
HFONT hTitleFont;
SP_CLASSIMAGELIST_DATA ImageListData;
PWSTR pDeviceStatusText;
HANDLE hProcessHeap;
typedef BOOL (WINAPI *PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
@ -74,6 +76,21 @@ StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
}
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
switch (lpnm->code)
{
case PSN_SETACTIVE:
{
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
}
break;
}
}
break;
}
return FALSE;
@ -82,6 +99,30 @@ StartPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK
SearchPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
/* TODO: PnP devices search */
}
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
switch (lpnm->code)
{
case PSN_SETACTIVE:
{
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK);
}
break;
}
}
break;
}
return FALSE;
}
@ -239,8 +280,10 @@ InitProbeListPage(HWND hwndDlg)
{
LV_COLUMN Column;
LV_ITEM Item;
WCHAR szBuffer[MAX_STR_SIZE], szGuid[MAX_STR_SIZE], szTrimGuid[MAX_STR_SIZE];
WCHAR szBuffer[MAX_STR_SIZE], szGuid[MAX_STR_SIZE],
szTrimGuid[MAX_STR_SIZE], szStatusText[MAX_STR_SIZE];
HWND hList = GetDlgItem(hwndDlg, IDC_PROBELIST);
PWSTR pstrStatusText;
HDEVINFO hDevInfo;
SP_DEVINFO_DATA DevInfoData;
ULONG ulStatus, ulProblemNumber;
@ -325,9 +368,19 @@ InitProbeListPage(HWND hwndDlg)
&ClassGuid,
&Item.iImage);
DeviceProblemTextW(NULL,
DevInfoData.DevInst,
ulProblemNumber,
szStatusText,
sizeof(szStatusText) / sizeof(WCHAR));
pstrStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, sizeof(szStatusText));
lstrcpy(pstrStatusText, szStatusText);
/* Set device name */
Item.pszText = (LPTSTR) szBuffer;
Item.pszText = (LPWSTR) szBuffer;
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
Item.lParam = (LPARAM) pstrStatusText;
Item.iItem = (INT) ListView_GetItemCount(hList);
(VOID) ListView_InsertItem(hList, &Item);
@ -341,10 +394,13 @@ InitProbeListPage(HWND hwndDlg)
static INT_PTR CALLBACK
ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
INT Index;
switch (uMsg)
{
case WM_INITDIALOG:
{
pDeviceStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, MAX_STR_SIZE);
InitProbeListPage(hwndDlg);
}
break;
@ -367,9 +423,102 @@ ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
case NM_CLICK:
{
Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
if (Index != -1)
{
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
}
}
break;
case PSN_WIZNEXT:
{
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_FINISHPAGE);
Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
if (Index != -1)
{
if (Index == 0)
{
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTWAYPAGE);
}
else
{
LVITEM Item;
PWSTR pts;
ZeroMemory(&Item, sizeof(LV_ITEM));
Item.mask = LVIF_PARAM;
Item.iItem = Index;
(VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
pts = (PWSTR) Item.lParam;
wcscpy(pDeviceStatusText, pts);
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_HWSTATUSPAGE);
}
}
return TRUE;
}
}
}
break;
case WM_DESTROY:
{
INT Index;
LVITEM Item;
for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
{
ZeroMemory(&Item, sizeof(LV_ITEM));
Item.mask = LVIF_PARAM;
Item.iItem = Index;
(VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
}
HeapFree(hProcessHeap, 0, (LPVOID) pDeviceStatusText);
}
break;
}
return FALSE;
}
static INT_PTR CALLBACK
SelectWayPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return FALSE;
}
static INT_PTR CALLBACK
DevStatusPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
/* Set title font */
SendDlgItemMessage(hwndDlg, IDC_FINISHTITLE, WM_SETFONT, (WPARAM)hTitleFont, (LPARAM)TRUE);
/* Set status text */
SetWindowText(GetDlgItem(hwndDlg, IDC_HWSTATUSEDIT), pDeviceStatusText);
}
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
switch (lpnm->code)
{
case PSN_SETACTIVE:
{
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH | PSWIZB_BACK);
}
break;
case PSN_WIZBACK:
{
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROBELISTPAGE);
return TRUE;
}
}
@ -383,7 +532,7 @@ ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static VOID
HardwareWizardInit(HWND hwnd)
{
HPROPSHEETPAGE ahpsp[6];
HPROPSHEETPAGE ahpsp[8];
PROPSHEETPAGE psp = {0};
PROPSHEETHEADER psh;
UINT nPages = 0;
@ -430,6 +579,26 @@ HardwareWizardInit(HWND hwnd)
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROBELISTPAGE);
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
/* Create select search way page */
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SELECTWAYTITLE);
psp.pszHeaderSubTitle = NULL;
psp.hInstance = hApplet;
psp.lParam = 0;
psp.pfnDlgProc = SelectWayPageDlgProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_SELECTWAYPAGE);
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
/* Create device status page */
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
psp.hInstance = hApplet;
psp.lParam = 0;
psp.pfnDlgProc = DevStatusPageDlgProc;
psp.pszTemplate = MAKEINTRESOURCE(IDD_HWSTATUSPAGE);
ahpsp[nPages++] = CreatePropertySheetPage(&psp);
/* Create finish page */
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
@ -527,6 +696,7 @@ DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
case DLL_PROCESS_ATTACH:
hApplet = hinstDLL;
hProcessHeap = GetProcessHeap();
DisableThreadLibraryCalls(hinstDLL);
break;
}

View file

@ -5,14 +5,17 @@
#include <commctrl.h>
#include <setupapi.h>
#include <cfgmgr32.h>
#include <reactos/dll/devmgr/devmgr.h>
#include <cpl.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#define NDEBUG
#include <debug.h>
#define MAX_STR_SIZE 256
#define MAX_STR_SIZE 255
extern HINSTANCE hApplet;

View file

@ -10,6 +10,8 @@
<library>rpcrt4</library>
<library>user32</library>
<library>gdi32</library>
<library>devmgr</library>
<library>ntdll</library>
<file>hdwwiz.c</file>
<file>hdwwiz.rc</file>
</module>

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -143,4 +143,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -147,4 +147,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Подключено ли устройство?"
IDS_PROBELISTTITLE "На этом компьютере уже установлено следующее оборудование"
IDS_ADDNEWDEVICE "Добавление нового устройства"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -146,4 +146,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -142,4 +142,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -150,4 +150,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -148,4 +148,5 @@ BEGIN
IDS_ISCONNECTED "Is the hardware connected?"
IDS_PROBELISTTITLE "The following hardware is already installed on your computer"
IDS_ADDNEWDEVICE "Add a new hardware device"
IDS_SELECTWAYTITLE "The wizard can help you install other hardware"
END

View file

@ -16,6 +16,7 @@
#define IDS_PROBELISTTITLE 1005
#define IDS_SEARCHTEXT 1020
#define IDS_SEARCHTITLE 1025
#define IDS_SELECTWAYTITLE 1027
#define IDS_ADDNEWDEVICE 1081
#define IDS_ISCONNECTED 1113