2015-06-16 21:13:28 +00:00
|
|
|
#pragma once
|
2015-06-17 21:26:42 +00:00
|
|
|
#include "DeviceNode.h"
|
|
|
|
#include "ClassNode.h"
|
2015-07-04 21:12:06 +00:00
|
|
|
#include "RootNode.h"
|
2015-06-16 21:13:28 +00:00
|
|
|
|
|
|
|
enum ViewType
|
|
|
|
{
|
|
|
|
DevicesByType,
|
|
|
|
DevicesByConnection,
|
|
|
|
ResourcesByType,
|
|
|
|
ResourcesByConnection
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CDeviceView
|
|
|
|
{
|
2015-10-15 17:21:37 +00:00
|
|
|
|
2015-06-16 21:13:28 +00:00
|
|
|
HWND m_hMainWnd;
|
|
|
|
HWND m_hTreeView;
|
|
|
|
HWND m_hPropertyDialog;
|
2015-06-17 08:15:08 +00:00
|
|
|
HMENU m_hMenu;
|
2015-06-16 21:13:28 +00:00
|
|
|
ViewType m_ViewType;
|
|
|
|
HTREEITEM m_hTreeRoot;
|
|
|
|
bool m_ShowHidden;
|
|
|
|
|
2015-10-15 17:21:37 +00:00
|
|
|
CRootNode *m_RootNode;
|
|
|
|
CAtlList<CClassNode *> m_ClassNodeList;
|
|
|
|
CAtlList<CDeviceNode *> m_DeviceNodeList;
|
|
|
|
SP_CLASSIMAGELIST_DATA m_ImageListData;
|
|
|
|
|
2015-06-16 21:13:28 +00:00
|
|
|
public:
|
|
|
|
CDeviceView(
|
|
|
|
HWND hMainWnd
|
|
|
|
);
|
|
|
|
|
|
|
|
~CDeviceView(void);
|
|
|
|
|
|
|
|
bool Initialize();
|
|
|
|
bool Uninitialize();
|
|
|
|
|
2015-06-17 08:15:08 +00:00
|
|
|
LRESULT OnSize(
|
2015-06-16 21:13:28 +00:00
|
|
|
_In_ int x,
|
|
|
|
_In_ int y,
|
|
|
|
_In_ int cx,
|
|
|
|
_In_ int cy
|
|
|
|
);
|
|
|
|
|
2015-06-17 08:15:08 +00:00
|
|
|
LRESULT OnRightClick(
|
|
|
|
_In_ LPNMHDR NmHdr
|
|
|
|
);
|
|
|
|
|
|
|
|
LRESULT OnContextMenu(
|
|
|
|
_In_ LPARAM lParam
|
|
|
|
);
|
|
|
|
|
2015-07-05 08:49:54 +00:00
|
|
|
LRESULT OnAction(
|
|
|
|
UINT Action
|
|
|
|
);
|
|
|
|
|
2015-06-16 21:13:28 +00:00
|
|
|
VOID Refresh(
|
|
|
|
_In_ ViewType Type,
|
|
|
|
_In_ bool ScanForChanges,
|
2015-10-23 13:16:25 +00:00
|
|
|
_In_ bool UpdateView
|
2015-06-16 21:13:28 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
VOID DisplayPropertySheet();
|
|
|
|
VOID SetFocus();
|
|
|
|
|
2015-06-17 08:15:08 +00:00
|
|
|
VOID SetHiddenDevices(_In_ bool ShowHidden)
|
2015-06-16 21:13:28 +00:00
|
|
|
{
|
|
|
|
m_ShowHidden = ShowHidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewType GetCurrentView() { return m_ViewType; }
|
|
|
|
|
2015-07-04 21:12:06 +00:00
|
|
|
bool CreateActionMenu(
|
|
|
|
_In_ HMENU OwnerMenu,
|
|
|
|
_In_ bool MainMenu
|
|
|
|
);
|
|
|
|
|
2015-07-05 08:49:54 +00:00
|
|
|
CNode* GetSelectedNode(
|
2015-06-25 18:59:23 +00:00
|
|
|
);
|
|
|
|
|
2015-06-16 21:13:28 +00:00
|
|
|
bool SelDeviceIsStarted();
|
|
|
|
bool SelDeviceIsInstalled();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool AddRootDevice();
|
|
|
|
|
|
|
|
bool RefreshDeviceList();
|
|
|
|
|
|
|
|
static unsigned int __stdcall RefreshThread(
|
|
|
|
void *Param
|
|
|
|
);
|
|
|
|
|
|
|
|
bool ListDevicesByConnection(
|
|
|
|
);
|
|
|
|
bool ListDevicesByType(
|
|
|
|
);
|
|
|
|
|
|
|
|
bool GetNextClass(
|
|
|
|
_In_ ULONG ClassIndex,
|
|
|
|
_Out_ LPGUID ClassGuid,
|
|
|
|
_Out_ HDEVINFO *hDevInfo
|
|
|
|
);
|
|
|
|
|
2015-06-18 10:26:30 +00:00
|
|
|
bool RecurseChildDevices(
|
2015-06-16 21:13:28 +00:00
|
|
|
_In_ DEVINST ParentDevice,
|
|
|
|
_In_ HTREEITEM hParentTreeItem
|
|
|
|
);
|
|
|
|
|
2015-07-05 08:49:54 +00:00
|
|
|
bool EnableSelectedDevice(
|
|
|
|
_In_ bool Enable,
|
|
|
|
_Out_ bool &NeedsReboot
|
|
|
|
);
|
|
|
|
|
2015-10-19 08:45:48 +00:00
|
|
|
bool UpdateSelectedDevice(
|
|
|
|
_Out_ bool &NeedsReboot
|
|
|
|
);
|
|
|
|
|
2015-07-05 08:49:54 +00:00
|
|
|
bool UninstallSelectedDevice(
|
|
|
|
);
|
|
|
|
|
2015-10-19 13:52:12 +00:00
|
|
|
bool RunAddHardwareWizard(
|
|
|
|
);
|
|
|
|
|
2015-06-16 21:13:28 +00:00
|
|
|
bool GetChildDevice(
|
|
|
|
_In_ DEVINST ParentDevInst,
|
|
|
|
_Out_ PDEVINST DevInst
|
|
|
|
);
|
|
|
|
|
|
|
|
bool GetSiblingDevice(
|
|
|
|
_In_ DEVINST PrevDevice,
|
|
|
|
_Out_ PDEVINST DevInst
|
|
|
|
);
|
|
|
|
|
|
|
|
HTREEITEM InsertIntoTreeView(
|
2015-07-04 21:12:06 +00:00
|
|
|
_In_opt_ HTREEITEM hParent,
|
2015-06-16 21:13:28 +00:00
|
|
|
_In_ CNode *Node
|
|
|
|
);
|
|
|
|
|
2015-07-04 21:12:06 +00:00
|
|
|
void BuildActionMenuForNode(
|
|
|
|
_In_ HMENU OwnerMenu,
|
2015-07-04 21:31:19 +00:00
|
|
|
_In_ CNode *Node,
|
|
|
|
_In_ bool MainMenu
|
2015-07-03 06:56:58 +00:00
|
|
|
);
|
|
|
|
|
2015-06-26 08:45:49 +00:00
|
|
|
HTREEITEM RecurseFindDevice(
|
|
|
|
_In_ HTREEITEM hParentItem,
|
2015-10-23 12:45:41 +00:00
|
|
|
_In_ CNode *Node
|
2015-06-16 21:13:28 +00:00
|
|
|
);
|
|
|
|
|
2015-06-26 08:45:49 +00:00
|
|
|
void SelectNode(
|
2015-10-23 12:45:41 +00:00
|
|
|
_In_ CNode *Node
|
2015-06-26 08:45:49 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
void EmptyDeviceView(
|
2015-06-16 21:13:28 +00:00
|
|
|
);
|
|
|
|
|
2015-06-18 13:08:11 +00:00
|
|
|
CNode* GetNode(
|
|
|
|
_In_ LPTV_ITEMW TvItem
|
|
|
|
);
|
2015-06-16 21:13:28 +00:00
|
|
|
|
2015-06-18 13:08:11 +00:00
|
|
|
CClassNode* GetClassNode(
|
|
|
|
_In_ LPGUID ClassGuid
|
|
|
|
);
|
|
|
|
CDeviceNode* GetDeviceNode(
|
|
|
|
_In_ DEVINST Device
|
|
|
|
);
|
2015-06-26 08:45:49 +00:00
|
|
|
void EmptyLists(
|
|
|
|
);
|
2015-06-16 21:13:28 +00:00
|
|
|
};
|
|
|
|
|