28 #define UPDATE_MSG (WM_APP + 1)
29 #define GRAPH_PADDING 5
30 #define CHECKBOX_PADDING 3
39 static HWND WindowHandle;
40 static RECT MinimumSize;
42 static RECT LayoutMargin;
43 static HWND *GraphHandle;
44 static HWND *CheckBoxHandle;
50 _In_ HWND ParentWindowHandle,
54 SysInfoParameters = Parameters;
64 _In_opt_ PVOID Parameter,
65 _In_opt_ PVOID Context
97 if (Button_GetCheck(CheckBoxHandle[i]) == BST_CHECKED)
124 ULONG numberOfColumns;
126 WindowHandle = hwndDlg;
136 CheckBoxHandle = PhAllocate(
sizeof(HWND) * EtGpuTotalNodeCount);
137 GraphState = PhAllocate(
sizeof(
PH_GRAPH_STATE) * EtGpuTotalNodeCount);
139 font = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
145 GraphHandle[i] = CreateWindow(
148 WS_VISIBLE | WS_CHILD | WS_BORDER,
159 CheckBoxHandle[i] = CreateWindow(
162 WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
172 SendMessage(CheckBoxHandle[i], WM_SETFONT, (WPARAM)font,
FALSE);
180 numberOfRows = (ULONG)sqrt(EtGpuTotalNodeCount);
181 numberOfColumns = (EtGpuTotalNodeCount + numberOfRows - 1) / numberOfRows;
183 MinimumSize.left = 0;
185 MinimumSize.right = 45;
186 MinimumSize.bottom = 60;
187 MapDialogRect(hwndDlg, &MinimumSize);
188 MinimumSize.right += (MinimumSize.right +
GRAPH_PADDING) * numberOfColumns;
189 MinimumSize.bottom += (MinimumSize.bottom +
GRAPH_PADDING) * numberOfRows;
192 MapWindowPoints(NULL, hwndDlg, (POINT *)&labelRect, 2);
193 labelRect.right += GetSystemMetrics(SM_CXFRAME) * 2;
199 MapDialogRect(hwndDlg, &tempRect);
200 labelRect.right += tempRect.right;
202 if (MinimumSize.right < labelRect.right)
203 MinimumSize.right = labelRect.right;
205 SetWindowPos(hwndDlg, NULL, 0, 0, MinimumSize.right, MinimumSize.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
237 ULONG numberOfYPaddings = numberOfRows - 1;
238 ULONG numberOfXPaddings = numberOfColumns - 1;
249 GetClientRect(hwndDlg, &clientRect);
250 GetClientRect(GetDlgItem(hwndDlg,
IDC_EXAMPLE), &checkBoxRect);
251 cellHeight = (clientRect.bottom - LayoutMargin.top - LayoutMargin.bottom -
GRAPH_PADDING * numberOfYPaddings) / numberOfRows;
252 y = LayoutMargin.top;
255 for (ULONG row = 0; row < numberOfRows; ++row)
259 if (row == numberOfRows - 1)
260 cellHeight = clientRect.bottom - LayoutMargin.bottom - y;
262 cellWidth = (clientRect.right - LayoutMargin.left - LayoutMargin.right -
GRAPH_PADDING * numberOfXPaddings) / numberOfColumns;
263 x = LayoutMargin.left;
265 for (ULONG column = 0; column < numberOfColumns; column++)
269 if (column == numberOfColumns - 1)
270 cellWidth = clientRect.right - LayoutMargin.right - x;
274 deferHandle = DeferWindowPos(
282 SWP_NOACTIVATE | SWP_NOZORDER
284 deferHandle = DeferWindowPos(
289 y + cellHeight - checkBoxRect.bottom,
292 SWP_NOACTIVATE | SWP_NOZORDER
302 EndDeferWindowPos(deferHandle);
312 switch (LOWORD(wParam))
317 EndDialog(hwndDlg, IDOK);
325 NMHDR *header = (NMHDR *)lParam;
328 switch (header->code)
340 if (header->hwndFrom == GraphHandle[i])
348 if (!GraphState[i].Valid)
367 if (header->hwndFrom == GraphHandle[i])
369 if (GraphState[i].TooltipIndex != getTooltipText->
Index)
378 if (adapterIndex != -1)
382 if (adapterDescription && adapterDescription->
Length == 0)
385 if (!adapterDescription)
386 adapterDescription =
PhFormatString(L
"Adapter %lu", adapterIndex);
394 L
"Node %lu on %s\n%.2f%%\n%s",
396 adapterDescription->
Buffer,
425 InvalidateRect(GraphHandle[i], NULL,
FALSE);