48 HMODULE shell32Handle;
49 HMODULE shlwapiHandle;
50 HMODULE uxthemeHandle;
52 shell32Handle = LoadLibrary(L
"shell32.dll");
53 shlwapiHandle = LoadLibrary(L
"shlwapi.dll");
54 uxthemeHandle = LoadLibrary(L
"uxtheme.dll");
60 RunFileDlg = (PVOID)GetProcAddress(shell32Handle, (PSTR)61);
62 IsThemeActive_I = (PVOID)GetProcAddress(uxthemeHandle,
"IsThemeActive");
63 OpenThemeData_I = (PVOID)GetProcAddress(uxthemeHandle,
"OpenThemeData");
67 DrawThemeText_I = (PVOID)GetProcAddress(uxthemeHandle,
"DrawThemeText");
68 GetThemeInt_I = (PVOID)GetProcAddress(uxthemeHandle,
"GetThemeInt");
89 _In_ HWND ListViewHandle,
91 _In_ INT DisplayIndex,
92 _In_ INT SubItemIndex,
100 column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
103 column.pszText = Text;
104 column.iSubItem = SubItemIndex;
105 column.iOrder = DisplayIndex;
107 return ListView_InsertColumn(ListViewHandle, Index, &column);
111 _In_ HWND ListViewHandle,
119 item.mask = LVIF_TEXT | LVIF_PARAM;
123 item.lParam = (LPARAM)Param;
125 return ListView_InsertItem(ListViewHandle, &item);
129 _In_ HWND ListViewHandle,
134 return ListView_GetNextItem(ListViewHandle, StartIndex, Flags);
138 _In_ HWND ListViewHandle,
145 findInfo.flags = LVFI_PARAM;
146 findInfo.lParam = (LPARAM)Param;
148 return ListView_FindItem(ListViewHandle, StartIndex, &findInfo);
152 _In_ HWND ListViewHandle,
154 _Out_ PINT ImageIndex
160 item.mask = LVIF_IMAGE;
164 result = ListView_GetItem(ListViewHandle, &item);
169 *ImageIndex = item.iImage;
175 _In_ HWND ListViewHandle,
183 item.mask = LVIF_PARAM;
187 result = ListView_GetItem(ListViewHandle, &item);
192 *Param = (PVOID)item.lParam;
198 _In_ HWND ListViewHandle,
202 ListView_DeleteItem(ListViewHandle, Index);
206 _In_ HWND ListViewHandle,
213 item.mask = LVIF_IMAGE;
216 item.iImage = ImageIndex;
218 ListView_SetItem(ListViewHandle, &item);
222 _In_ HWND ListViewHandle,
224 _In_ INT SubItemIndex,
230 item.mask = LVIF_TEXT;
232 item.iSubItem = SubItemIndex;
235 ListView_SetItem(ListViewHandle, &item);
239 _In_ HWND ListViewHandle,
243 #define ORDER_LIMIT 50
249 if (Settings->Length == 0)
252 remainingPart = Settings->sr;
254 memset(orderArray, 0,
sizeof(orderArray));
257 while (remainingPart.
Length != 0)
268 if (columnPart.
Length == 0)
281 order = (ULONG)integer;
285 orderArray[order] = columnIndex;
287 if (maxOrder < order + 1)
288 maxOrder = order + 1;
296 lvColumn.mask = LVCF_WIDTH;
297 lvColumn.cx = (ULONG)integer;
298 ListView_SetColumn(ListViewHandle, columnIndex, &lvColumn);
303 ListView_SetColumnOrderArray(ListViewHandle, maxOrder, orderArray);
309 _In_ HWND ListViewHandle
318 lvColumn.mask = LVCF_WIDTH | LVCF_ORDER;
320 while (ListView_GetColumn(ListViewHandle, i, &lvColumn))
338 _In_ HWND TabControlHandle,
345 item.mask = TCIF_TEXT;
348 return TabCtrl_InsertItem(TabControlHandle, Index, &item);
375 length = InternalGetWindowText(hwnd, buffer,
sizeof(buffer) /
sizeof(WCHAR));
381 length = InternalGetWindowText(hwnd, string->
Buffer, (ULONG)string->
Length /
sizeof(WCHAR) + 1);
382 string->Length = length *
sizeof(WCHAR);
394 length = GetWindowTextLength(hwnd);
406 if (GetWindowText(hwnd, string->
Buffer, (ULONG)string->
Length /
sizeof(WCHAR) + 1))
430 _In_ ULONG NumberOfStrings
435 for (i = 0; i < NumberOfStrings; i++)
436 ComboBox_AddString(hWnd, Strings[i]);
449 Index = ComboBox_GetCurSel(hwnd);
455 length = ComboBox_GetLBTextLen(hwnd, Index);
457 if (length == CB_ERR)
464 if (ComboBox_GetLBText(hwnd, Index, string->
Buffer) != CB_ERR)
483 return ComboBox_SelectString(hwnd, -1, String);
489 index = ComboBox_FindStringExact(hwnd, -1, String);
494 ComboBox_SetCurSel(hwnd, index);
510 Index = ListBox_GetCurSel(hwnd);
516 length = ListBox_GetTextLen(hwnd, Index);
518 if (length == LB_ERR)
525 if (ListBox_GetText(hwnd, Index, string->
Buffer) != LB_ERR)
545 count = ListView_GetItemCount(hWnd);
550 for (i = 0; i < count; i++)
552 ListView_SetItemState(hWnd, i, State, Mask);
587 _Out_ PULONG NumberOfItems
614 *NumberOfItems = list->
Count;
620 _In_ HIMAGELIST ImageList,
622 _In_ HINSTANCE InstanceHandle,
623 _In_ LPCWSTR BitmapName
628 bitmap = LoadImage(InstanceHandle, BitmapName, IMAGE_BITMAP, 0, 0, 0);
632 ImageList_Replace(ImageList, Index, bitmap, NULL);
633 DeleteObject(bitmap);
646 _Out_opt_ HICON *SmallIcon,
647 _Out_opt_ HICON *LargeIcon
651 static HICON smallIcon = NULL;
652 static HICON largeIcon = NULL;
694 ExtractIconEx(dllFileName->
Buffer, index, &largeIcon, &smallIcon, 1);
700 smallIcon = LoadIcon(NULL, IDI_APPLICATION);
702 largeIcon = LoadIcon(NULL, IDI_APPLICATION);
708 *SmallIcon = smallIcon;
710 *LargeIcon = largeIcon;
714 _In_opt_ PWSTR FileName,
715 _In_opt_ PWSTR DefaultExtension,
716 _In_ BOOLEAN LargeIcon
734 LargeIcon ? &icon : NULL,
735 !LargeIcon ? &icon : NULL,
743 !LargeIcon ? &icon : NULL,
744 LargeIcon ? &icon : NULL
748 icon = DuplicateIcon(NULL, icon);
754 iconFlag = LargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON;
757 if (FileName && SHGetFileInfo(
762 SHGFI_ICON | iconFlag
765 icon = fileInfo.hIcon;
768 if (!icon && DefaultExtension)
772 FILE_ATTRIBUTE_NORMAL,
775 SHGFI_ICON | iconFlag | SHGFI_USEFILEATTRIBUTES
777 icon = fileInfo.hIcon;
789 if (OpenClipboard(hWnd))
791 if (!EmptyClipboard())
794 if (!SetClipboardData(Format, Data))
814 data = GlobalAlloc(GMEM_MOVEABLE, String->Length +
sizeof(WCHAR));
815 memory = GlobalLock(data);
817 memcpy(memory, String->Buffer, String->Length);
818 *(PWCHAR)((PCHAR)memory + String->Length) = 0;
820 GlobalUnlock(memory);
830 _In_ DLGPROC DialogProc,
836 HGLOBAL resourceHandle;
841 resourceInfo = FindResource(Instance, Template, MAKEINTRESOURCE(RT_DIALOG));
846 resourceSize = SizeofResource(Instance, resourceInfo);
848 if (resourceSize == 0)
851 resourceHandle = LoadResource(Instance, resourceInfo);
856 dialog = LockResource(resourceHandle);
865 dialogCopy->
style = Style;
869 ((DLGTEMPLATE *)dialogCopy)->style = Style;
872 dialogHandle = CreateDialogIndirectParam(Instance, (DLGTEMPLATE *)dialogCopy, Parent, DialogProc, (LPARAM)Parameter);
881 _In_ HWND RootWindowHandle
885 Manager->LayoutNumber = 0;
887 Manager->RootItem.Handle = RootWindowHandle;
888 GetClientRect(Manager->RootItem.Handle, &Manager->RootItem.Rect);
889 Manager->RootItem.OrigRect = Manager->RootItem.Rect;
890 Manager->RootItem.ParentItem = NULL;
891 Manager->RootItem.LayoutParentItem = NULL;
892 Manager->RootItem.LayoutNumber = 0;
893 Manager->RootItem.NumberOfChildren = 0;
894 Manager->RootItem.DeferHandle = NULL;
903 for (i = 0; i < Manager->List->Count; i++)
904 PhFree(Manager->List->Items[i]);
957 ParentItem = &Manager->RootItem;
977 GetWindowRect(Handle, &item->
Rect);
983 TabCtrl_AdjustRect(Handle,
FALSE, &item->
Rect);
1001 BOOLEAN hasDummyParent;
1003 if (Item->NumberOfChildren > 0 && !Item->DeferHandle)
1004 Item->DeferHandle = BeginDeferWindowPos(Item->NumberOfChildren);
1006 if (Item->LayoutNumber == Manager->LayoutNumber)
1010 if (!Item->ParentItem)
1015 if (Item->ParentItem != Item->LayoutParentItem)
1018 hasDummyParent =
TRUE;
1022 hasDummyParent =
FALSE;
1025 GetWindowRect(Item->Handle, &Item->Rect);
1026 MapWindowPoints(NULL, Item->LayoutParentItem->Handle, (POINT *)&Item->Rect, 2);
1031 TabCtrl_AdjustRect(Item->Handle,
FALSE, &Item->Rect);
1050 rect.left = (hasDummyParent ? Item->ParentItem->Rect.left : 0) + Item->Margin.left;
1051 rect.right = Item->Margin.right;
1055 ULONG diff = Item->Margin.right - rect.right;
1072 rect.top = (hasDummyParent ? Item->ParentItem->Rect.top : 0) + Item->Margin.top;
1073 rect.bottom = Item->Margin.bottom;
1077 ULONG diff = Item->Margin.bottom - rect.bottom;
1080 rect.bottom += diff;
1090 Item->LayoutParentItem->DeferHandle = DeferWindowPos(
1091 Item->LayoutParentItem->DeferHandle, Item->Handle,
1092 NULL, rect.left, rect.top,
1093 rect.right - rect.left, rect.bottom - rect.top,
1094 SWP_NOACTIVATE | SWP_NOZORDER
1102 NULL, rect.left, rect.top,
1103 rect.right - rect.left, rect.bottom - rect.top,
1104 SWP_NOACTIVATE | SWP_NOZORDER
1109 Item->LayoutNumber = Manager->LayoutNumber;
1118 Manager->LayoutNumber++;
1120 GetClientRect(Manager->RootItem.Handle, &Manager->RootItem.Rect);
1122 for (i = 0; i < Manager->List->Count; i++)
1129 for (i = 0; i < Manager->List->Count; i++)
1145 if (Manager->RootItem.DeferHandle)
1147 EndDeferWindowPos(Manager->RootItem.DeferHandle);
1148 Manager->RootItem.DeferHandle = NULL;