Author: cwittich
Date: Sat May 30 20:32:37 2015
New Revision: 67979
URL:
http://svn.reactos.org/svn/reactos?rev=67979&view=rev
Log:
[DEVMGMT_NEW]
show popupmenu on right click (not finished yet)
Modified:
trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp
trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h
trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp
Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp [iso-8859-1] Sat
May 30 20:32:37 2015
@@ -53,6 +53,8 @@
{
delete m_Devices;
m_Devices = NULL;
+
+ DestroyMenu(m_hShortcutMenu);
}
BOOL
@@ -63,6 +65,14 @@
/* Initialize the devices class */
bSuccess = m_Devices->Initialize();
if (bSuccess == FALSE) return FALSE;
+
+ /* Create Popup Menu */
+ m_hShortcutMenu = LoadMenu(g_hInstance,
+ MAKEINTRESOURCE(IDR_POPUP));
+ m_hShortcutMenu = GetSubMenu(m_hShortcutMenu,
+ 0);
+ SetMenuDefaultItem(m_hShortcutMenu, IDC_PROP, FALSE);
+
/* Create the main treeview */
m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
@@ -100,6 +110,36 @@
(VOID)m_Devices->Uninitialize();
return TRUE;
+}
+
+VOID
+CDeviceView::ShowContextMenu(
+ _In_ INT xPos,
+ _In_ INT yPos)
+{
+ HTREEITEM hSelected;
+ POINT pt;
+ RECT rc;
+
+ hSelected = TreeView_GetSelection(m_hTreeView);
+
+ if (TreeView_GetItemRect(m_hTreeView,
+ hSelected,
+ &rc,
+ TRUE))
+ {
+ if (GetCursorPos(&pt) &&
+ ScreenToClient(m_hTreeView, &pt) &&
+ PtInRect(&rc, pt))
+ {
+ TrackPopupMenuEx(m_hShortcutMenu,
+ TPM_RIGHTBUTTON,
+ xPos,
+ yPos,
+ m_hMainWnd,
+ NULL);
+ }
+ }
}
VOID
Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h [iso-8859-1] Sat May
30 20:32:37 2015
@@ -15,7 +15,7 @@
HWND m_hMainWnd;
HWND m_hTreeView;
HWND m_hPropertyDialog;
- HWND m_hShortcutMenu;
+ HMENU m_hShortcutMenu;
ListDevices m_ListDevices;
HIMAGELIST m_ImageList;
@@ -34,6 +34,11 @@
BOOL Initialize();
BOOL Uninitialize();
+ VOID ShowContextMenu(
+ _In_ INT xPos,
+ _In_ INT yPos
+ );
+
VOID Size(
_In_ INT x,
_In_ INT y,
Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp [iso-8859-1] Sat
May 30 20:32:37 2015
@@ -449,6 +449,10 @@
LRESULT
CMainWindow::OnContext(LPARAM lParam)
{
+ INT xPos = GET_X_LPARAM(lParam);
+ INT yPos = GET_Y_LPARAM(lParam);
+
+ m_DeviceView->ShowContextMenu(xPos, yPos);
return 0;
}