24 #define RFF_NOBROWSE 0x0001
25 #define RFF_NODEFAULT 0x0002
26 #define RFF_CALCDIRECTORY 0x0004
27 #define RFF_NOLABEL 0x0008
28 #define RFF_NOSEPARATEMEM 0x0020
30 #define RFN_VALIDATE (-510)
45 #define RF_CANCEL 0x0001
46 #define RF_RETRY 0x0002
53 _In_opt_ LPCWSTR lpszDirectory,
54 _In_opt_ LPCWSTR lpszTitle,
55 _In_opt_ LPCWSTR lpszDescription,
65 _In_ LPCWSTR pszClassList
83 _In_
const RECT *pRect,
84 _In_
const RECT *pClipRect
92 _In_reads_(cchText) LPCWSTR pszText,
94 _In_ DWORD dwTextFlags,
95 _Reserved_ DWORD dwTextFlags2,
113 _In_ const TASKDIALOGCONFIG *pTaskConfig,
115 _In_
int *pnRadioButton,
116 _In_
BOOL *pfVerificationFlagChecked
150 style = GetWindowLongPtr(Handle, GWL_STYLE);
151 style = (style & ~Mask) | (Value & Mask);
152 SetWindowLongPtr(Handle, GWL_STYLE, style);
163 style = GetWindowLongPtr(Handle, GWL_EXSTYLE);
164 style = (style & ~Mask) | (Value & Mask);
165 SetWindowLongPtr(Handle, GWL_EXSTYLE, style);
169 #define WM_REFLECT 0x2000
172 #define REFLECT_MESSAGE(hwnd, msg, wParam, lParam) \
174 LRESULT result_ = PhReflectMessage(hwnd, msg, wParam, lParam); \
180 #define REFLECT_MESSAGE_DLG(hwndDlg, hwnd, msg, wParam, lParam) \
182 LRESULT result_ = PhReflectMessage(hwnd, msg, wParam, lParam); \
186 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, result_); \
198 if (Message == WM_NOTIFY)
200 LPNMHDR header = (LPNMHDR)lParam;
202 if (header->hwndFrom == Handle)
203 return SendMessage(Handle,
WM_REFLECT + Message, wParam, lParam);
209 #define PH_DEFINE_MAKE_ATOM(AtomName) \
211 static UNICODE_STRING atomName = RTL_CONSTANT_STRING(AtomName); \
212 static PH_INITONCE initOnce = PH_INITONCE_INIT; \
213 static RTL_ATOM atom = 0; \
215 if (PhBeginInitOnce(&initOnce)) \
217 NtAddAtom(atomName.Buffer, atomName.Length, &atom); \
218 PhEndInitOnce(&initOnce); \
222 return (PWSTR)(ULONG_PTR)atom; \
224 return atomName.Buffer; \
229 _In_ BOOLEAN AllowDragDrop,
230 _In_ BOOLEAN ShowLabelTips
235 style = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP;
238 style |= LVS_EX_HEADERDRAGDROP;
240 style |= LVS_EX_LABELTIP;
242 ListView_SetExtendedListViewStyleEx(
251 _In_ HWND ListViewHandle,
253 _In_ INT DisplayIndex,
254 _In_ INT SubItemIndex,
262 _In_ HWND ListViewHandle,
270 _In_ HWND ListViewHandle,
277 _In_ HWND ListViewHandle,
284 _In_ HWND ListViewHandle,
286 _Out_ PINT ImageIndex
291 _In_ HWND ListViewHandle,
298 _In_ HWND ListViewHandle,
304 _In_ HWND ListViewHandle,
311 _In_ HWND ListViewHandle,
313 _In_ INT SubItemIndex,
319 _In_ HWND ListViewHandle,
325 _In_ HWND ListViewHandle
330 _In_ HWND TabControlHandle,
335 #define PhaGetDlgItemText(hwndDlg, id) \
336 ((PPH_STRING)PhAutoDereferenceObject(PhGetWindowText(GetDlgItem(hwndDlg, id))))
343 #define PH_GET_WINDOW_TEXT_INTERNAL 0x1
344 #define PH_GET_WINDOW_TEXT_LENGTH_ONLY 0x2
357 _In_ ULONG NumberOfStrings
395 _Out_ PULONG NumberOfItems
400 _In_ HIMAGELIST ImageList,
402 _In_ HINSTANCE InstanceHandle,
403 _In_ LPCWSTR BitmapName
408 _Out_opt_ HICON *SmallIcon,
409 _Out_opt_ HICON *LargeIcon
414 _In_opt_ PWSTR FileName,
415 _In_opt_ PWSTR DefaultExtension,
416 _In_ BOOLEAN LargeIcon
444 _In_ DLGPROC DialogProc,
448 #define PH_ANCHOR_LEFT 0x1
449 #define PH_ANCHOR_TOP 0x2
450 #define PH_ANCHOR_RIGHT 0x4
451 #define PH_ANCHOR_BOTTOM 0x8
452 #define PH_ANCHOR_ALL 0xf
456 #define PH_LAYOUT_FORCE_INVALIDATE 0x1000 // invalidate the control when it is resized
457 #define PH_LAYOUT_TAB_CONTROL 0x2000 // this is a dummy item, a hack for the tab control
458 #define PH_LAYOUT_IMMEDIATE_RESIZE 0x4000 // needed for the tab control hack
460 #define PH_LAYOUT_DUMMY_MASK (PH_LAYOUT_TAB_CONTROL) // items that don't have a window handle, or don't actually get their window resized
487 _Out_ PPH_LAYOUT_MANAGER Manager,
488 _In_ HWND RootWindowHandle
493 _Inout_ PPH_LAYOUT_MANAGER Manager
498 _Inout_ PPH_LAYOUT_MANAGER Manager,
500 _In_opt_ PPH_LAYOUT_ITEM ParentItem,
506 _Inout_ PPH_LAYOUT_MANAGER Manager,
508 _In_opt_ PPH_LAYOUT_ITEM ParentItem,
515 _Inout_ PPH_LAYOUT_MANAGER Manager
521 _In_
LONG MinimumWidth,
522 _In_
LONG MinimumHeight
525 if (Edge == WMSZ_BOTTOMRIGHT || Edge == WMSZ_RIGHT || Edge == WMSZ_TOPRIGHT)
527 if (Rect->right - Rect->left < MinimumWidth)
528 Rect->right = Rect->left + MinimumWidth;
530 else if (Edge == WMSZ_BOTTOMLEFT || Edge == WMSZ_LEFT || Edge == WMSZ_TOPLEFT)
532 if (Rect->right - Rect->left < MinimumWidth)
533 Rect->left = Rect->right - MinimumWidth;
536 if (Edge == WMSZ_BOTTOMRIGHT || Edge == WMSZ_BOTTOM || Edge == WMSZ_BOTTOMLEFT)
538 if (Rect->bottom - Rect->top < MinimumHeight)
539 Rect->bottom = Rect->top + MinimumHeight;
541 else if (Edge == WMSZ_TOPRIGHT || Edge == WMSZ_TOP || Edge == WMSZ_TOPLEFT)
543 if (Rect->bottom - Rect->top < MinimumHeight)
544 Rect->top = Rect->bottom - MinimumHeight;
549 _In_ HWND ParentWindowHandle,
550 _In_ HWND FromControlHandle,
551 _In_ HWND ToControlHandle
556 GetWindowRect(FromControlHandle, &windowRect);
557 MapWindowPoints(NULL, ParentWindowHandle, (POINT *)&windowRect, 2);
558 MoveWindow(ToControlHandle, windowRect.left, windowRect.top,
559 windowRect.right - windowRect.left, windowRect.bottom - windowRect.top,
FALSE);
575 #define PH_ALIGN_CENTER 0x0
576 #define PH_ALIGN_LEFT 0x1
577 #define PH_ALIGN_RIGHT 0x2
578 #define PH_ALIGN_TOP 0x4
579 #define PH_ALIGN_BOTTOM 0x8
599 _In_opt_ PVOID Context
605 _In_opt_ PVOID Context
626 #define ELVM_ADDFALLBACKCOLUMN (WM_APP + 1106)
627 #define ELVM_ADDFALLBACKCOLUMNS (WM_APP + 1109)
628 #define ELVM_RESERVED5 (WM_APP + 1120)
629 #define ELVM_INIT (WM_APP + 1102)
630 #define ELVM_SETCOLUMNWIDTH (WM_APP + 1121)
631 #define ELVM_SETCOMPAREFUNCTION (WM_APP + 1104)
632 #define ELVM_SETCONTEXT (WM_APP + 1103)
633 #define ELVM_SETCURSOR (WM_APP + 1114)
634 #define ELVM_RESERVED4 (WM_APP + 1118)
635 #define ELVM_SETITEMCOLORFUNCTION (WM_APP + 1111)
636 #define ELVM_SETITEMFONTFUNCTION (WM_APP + 1117)
637 #define ELVM_RESERVED1 (WM_APP + 1112)
638 #define ELVM_SETREDRAW (WM_APP + 1116)
639 #define ELVM_RESERVED2 (WM_APP + 1113)
640 #define ELVM_SETSORT (WM_APP + 1108)
641 #define ELVM_SETSORTFAST (WM_APP + 1119)
642 #define ELVM_RESERVED0 (WM_APP + 1110)
643 #define ELVM_SETTRISTATE (WM_APP + 1107)
644 #define ELVM_SETTRISTATECOMPAREFUNCTION (WM_APP + 1105)
645 #define ELVM_SORTITEMS (WM_APP + 1101)
646 #define ELVM_RESERVED3 (WM_APP + 1115)
648 #define ExtendedListView_AddFallbackColumn(hWnd, Column) \
649 SendMessage((hWnd), ELVM_ADDFALLBACKCOLUMN, (WPARAM)(Column), 0)
650 #define ExtendedListView_AddFallbackColumns(hWnd, NumberOfColumns, Columns) \
651 SendMessage((hWnd), ELVM_ADDFALLBACKCOLUMNS, (WPARAM)(NumberOfColumns), (LPARAM)(Columns))
652 #define ExtendedListView_Init(hWnd) \
653 SendMessage((hWnd), ELVM_INIT, 0, 0)
654 #define ExtendedListView_SetColumnWidth(hWnd, Column, Width) \
655 SendMessage((hWnd), ELVM_SETCOLUMNWIDTH, (WPARAM)(Column), (LPARAM)(Width))
656 #define ExtendedListView_SetCompareFunction(hWnd, Column, CompareFunction) \
657 SendMessage((hWnd), ELVM_SETCOMPAREFUNCTION, (WPARAM)(Column), (LPARAM)(CompareFunction))
658 #define ExtendedListView_SetContext(hWnd, Context) \
659 SendMessage((hWnd), ELVM_SETCONTEXT, 0, (LPARAM)(Context))
660 #define ExtendedListView_SetCursor(hWnd, Cursor) \
661 SendMessage((hWnd), ELVM_SETCURSOR, 0, (LPARAM)(Cursor))
662 #define ExtendedListView_SetItemColorFunction(hWnd, ItemColorFunction) \
663 SendMessage((hWnd), ELVM_SETITEMCOLORFUNCTION, 0, (LPARAM)(ItemColorFunction))
664 #define ExtendedListView_SetItemFontFunction(hWnd, ItemFontFunction) \
665 SendMessage((hWnd), ELVM_SETITEMFONTFUNCTION, 0, (LPARAM)(ItemFontFunction))
666 #define ExtendedListView_SetRedraw(hWnd, Redraw) \
667 SendMessage((hWnd), ELVM_SETREDRAW, (WPARAM)(Redraw), 0)
668 #define ExtendedListView_SetSort(hWnd, Column, Order) \
669 SendMessage((hWnd), ELVM_SETSORT, (WPARAM)(Column), (LPARAM)(Order))
670 #define ExtendedListView_SetSortFast(hWnd, Fast) \
671 SendMessage((hWnd), ELVM_SETSORTFAST, (WPARAM)(Fast), 0)
672 #define ExtendedListView_SetTriState(hWnd, TriState) \
673 SendMessage((hWnd), ELVM_SETTRISTATE, (WPARAM)(TriState), 0)
674 #define ExtendedListView_SetTriStateCompareFunction(hWnd, CompareFunction) \
675 SendMessage((hWnd), ELVM_SETTRISTATECOMPAREFUNCTION, 0, (LPARAM)(CompareFunction))
676 #define ExtendedListView_SortItems(hWnd) \
677 SendMessage((hWnd), ELVM_SORTITEMS, 0, 0)
679 #define ELVSCW_AUTOSIZE (-1)
680 #define ELVSCW_AUTOSIZE_USEHEADER (-2)
681 #define ELVSCW_AUTOSIZE_REMAININGSPACE (-3)
697 ULONG r = Color & 0xff;
698 ULONG g = (Color >> 8) & 0xff;
699 ULONG b = (Color >> 16) & 0xff;
704 if (g < min) min = g;
705 if (b < min) min = b;
708 if (g > max) max = g;
709 if (b > max) max = b;
711 return (min + max) / 2;
726 *((PUCHAR)&Color) /= 2;
727 *((PUCHAR)&Color + 1) /= 2;
728 *((PUCHAR)&Color + 2) /= 2;
745 g = (UCHAR)(Color >> 8);
746 b = (UCHAR)(Color >> 16);
748 if (r <= 255 - Increment)
753 if (g <= 255 - Increment)
758 if (b <= 255 - Increment)