ReactOS  0.4.14-dev-50-g13bb5e2
mainwnd.c
Go to the documentation of this file.
1 /*
2  * Gdi handle viewer
3  *
4  * mainwnd.c
5  *
6  * Copyright (C) 2007 Timo Kreuzer <timo <dot> kreuzer <at> reactos <dot> org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 #include "gdihv.h"
24 
26 
27 
28 static LRESULT
30 {
31  HWND hProcessListctrl, hHandleListCtrl, hProcessRefresh, hHandleRefresh;
32  RECT rect;
33 
34  hProcessListctrl = GetDlgItem(hMainWnd, IDC_PROCESSLIST);
35  hHandleListCtrl = GetDlgItem(hMainWnd, IDC_HANDLELIST);
36  hProcessRefresh = GetDlgItem(hMainWnd, IDC_REFRESHPROCESS);
37  hHandleRefresh = GetDlgItem(hMainWnd, IDC_REFRESHHANDLE);
38 
40 
41 //g_Separator = (rect.right / 2);
42  MoveWindow(hProcessListctrl, 5, 5, g_Separator - 5, rect.bottom - 40, TRUE);
43  MoveWindow(hHandleListCtrl, g_Separator + 5, 5, rect.right - g_Separator - 5, rect.bottom - 40, TRUE);
44  MoveWindow(hProcessRefresh, g_Separator - 90, rect.bottom - 30, 90, 25, TRUE);
45  MoveWindow(hHandleRefresh, rect.right - 90, rect.bottom - 30, 90, 25, TRUE);
46 
47  return 0;
48 }
49 
50 
51 static LRESULT
53 {
54  LPNMHDR pnmh = (LPNMHDR)lParam;
55 
56  switch(pnmh->code)
57  {
58  case LVN_ITEMCHANGED:
59  {
60  LPNMLISTVIEW pnmlv = (LPNMLISTVIEW)pnmh;
61  if ((wParam == IDC_PROCESSLIST)
62  && (pnmlv->uNewState & LVIS_SELECTED)
63  && !(pnmlv->uOldState & LVIS_SELECTED))
64  {
65  LV_ITEM item;
66  memset(&item, 0, sizeof(LV_ITEM));
67  item.mask = LVIF_PARAM;
68  item.iItem = pnmlv->iItem;
71  return TRUE;
72  }
73  break;
74  }
75  }
76 
77  return 0;
78 }
79 
82 {
83  switch (message)
84  {
85  case WM_INITDIALOG:
86  {
87  RECT rect;
88 
93  g_Separator = (rect.right / 2);
97 
98  break;
99  }
100  case WM_SIZE:
101  return MainWindow_OnSize(hMainWnd);
102 
103  case WM_COMMAND:
104  {
105  switch (LOWORD(wParam))
106  {
107  case IDOK:
108  case IDCANCEL:
109  {
111  break;
112  }
113  case IDC_REFRESHHANDLE:
114  {
115  LV_ITEM item;
116  HWND hProcessListCtrl = GetDlgItem(hMainWnd, IDC_PROCESSLIST);
117  memset(&item, 0, sizeof(LV_ITEM));
118  item.mask = LVIF_PARAM;
119  item.iItem = ListView_GetSelectionMark(hProcessListCtrl);
120  (void)ListView_GetItem(hProcessListCtrl, &item);
122  break;
123  }
124  case IDC_REFRESHPROCESS:
125  {
127  break;
128  }
129  default:
130  {
131  return FALSE;
132  }
133  }
134  break;
135  }
136 
137  case WM_NOTIFY:
139 
140  default:
141  {
142  return FALSE;
143  }
144  }
145  return TRUE;
146 }
147 
#define LV_ITEM
Definition: commctrl.h:2309
#define MAKEINTRESOURCE
Definition: winuser.h:591
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT uNewState
Definition: commctrl.h:3008
#define IDC_PROCESSLIST
Definition: resource.h:37
VOID HandleList_Create(HWND hListCtrl)
Definition: handlelist.c:26
#define LVN_ITEMCHANGED
Definition: commctrl.h:3103
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2706
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT_PTR
Definition: typedefs.h:62
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
#define IDC_REFRESHHANDLE
Definition: resource.h:5
VOID ProcessList_Create(HWND hListCtrl)
Definition: proclist.c:26
#define LVIS_SELECTED
Definition: commctrl.h:2291
UINT uOldState
Definition: commctrl.h:3009
LONG_PTR LPARAM
Definition: windef.h:208
VOID HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
Definition: handlelist.c:69
#define IDC_REFRESHPROCESS
Definition: resource.h:6
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1593
static LRESULT MainWnd_OnNotify(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:52
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2697
HWND hMainWnd
Definition: magnifier.c:32
#define IDI_MAIN
Definition: resource.h:4
VOID ProcessList_Update(HWND hListCtrl)
Definition: proclist.c:44
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
INT_PTR CALLBACK MainWindow_WndProc(HWND hMainWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:81
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static ATOM item
Definition: dde.c:856
struct tagNMLISTVIEW * LPNMLISTVIEW
#define IDC_HANDLELIST
Definition: resource.h:4
unsigned int UINT
Definition: ndis.h:50
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define SendMessage
Definition: winuser.h:5744
#define LVIF_PARAM
Definition: commctrl.h:2283
#define LoadIcon
Definition: winuser.h:5714
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2761
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define memset(x, y, z)
Definition: compat.h:39
static LRESULT MainWindow_OnSize(HWND hMainWnd)
Definition: mainwnd.c:29
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
INT g_Separator
Definition: mainwnd.c:25
#define WM_NOTIFY
Definition: richedit.h:61
#define ICON_BIG
Definition: tnclass.cpp:51