- Implement updating the device from the toolbar
- Add a message before uninstalling a device. Dedicated to Jared Smudde.

svn path=/trunk/; revision=69614
This commit is contained in:
Ged Murphy
2015-10-19 08:45:48 +00:00
parent 016e5d9466
commit 4c9058d60f
2 changed files with 36 additions and 1 deletions
@@ -271,7 +271,8 @@ CDeviceView::OnAction(
case IDC_UPDATE_DRV:
{
MessageBox(m_hMainWnd, L"Not yet implemented", L"Update Driver", MB_OK);
bool NeedsReboot;
UpdateSelectedDevice(NeedsReboot);
break;
}
@@ -740,6 +741,24 @@ CDeviceView::EnableSelectedDevice(
return false;
}
bool
CDeviceView::UpdateSelectedDevice(
_Out_ bool &NeedsReboot
)
{
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
if (Node == nullptr) return false;
DWORD dwReboot;
if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
{
NeedsReboot = false;
return true;
}
return false;
}
bool
CDeviceView::UninstallSelectedDevice(
)
@@ -747,6 +766,18 @@ CDeviceView::UninstallSelectedDevice(
CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
if (Node == nullptr) return false;
CAtlStringW str;
if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
{
if (MessageBoxW(m_hMainWnd,
str,
Node->GetDisplayName(),
MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
{
return false;
}
}
return Node->UninstallDevice();
}
@@ -115,6 +115,10 @@ private:
_Out_ bool &NeedsReboot
);
bool UpdateSelectedDevice(
_Out_ bool &NeedsReboot
);
bool UninstallSelectedDevice(
);