Debian Codegraph @

components/KASToolBar/dwtaskbarlist.pas

raw
1 unit dwTaskbarList;
2
3 {$mode delphi}{$H+}
4
5 interface
6
7 uses
8 Messages
9 , Windows
10 ;
11
12 const
13 CLSID_TaskbarList: TGUID = '{56FDF344-FD6D-11D0-958A-006097C9A090}';
14 CLSID_TaskbarList2: TGUID = '{602D4995-B13A-429B-A66E-1935E44F4317}';
15 CLSID_TaskbarList3: TGUID = '{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}';
16
17 const
18 THBF_ENABLED = $0000;
19 THBF_DISABLED = $0001;
20 THBF_DISMISSONCLICK = $0002;
21 THBF_NOBACKGROUND = $0004;
22 THBF_HIDDEN = $0008;
23
24 const
25 THB_BITMAP = $0001;
26 THB_ICON = $0002;
27 THB_TOOLTIP = $0004;
28 THB_FLAGS = $0008;
29
30 const
31 THBN_CLICKED = $1800;
32
33 const
34 TBPF_NOPROGRESS = $00;
35 TBPF_INDETERMINATE = $01;
36 TBPF_NORMAL = $02;
37 TBPF_ERROR= $04;
38 TBPF_PAUSED = $08;
39
40 const
41 TBATF_USEMDITHUMBNAIL: DWORD = $00000001;
42 TBATF_USEMDILIVEPREVIEW: DWORD = $00000002;
43
44 const
45 WM_DWMSENDICONICTHUMBNAIL = $0323;
46 WM_DWMSENDICONICLIVEPREVIEWBITMAP = $0326;
47
48 type
49 TTipString = array[0..259] of WideChar;
50 PTipString = ^TTipString;
51 tagTHUMBBUTTON = packed record
52 dwMask
53 : DWORD;
54 iId
55 , iBitmap
56 : UINT;
57 hIcon
58 : HICON;
59 szTip
60 : TTipString;
61 dwFlags
62 : DWORD;
63 end;
64 THUMBBUTTON = tagTHUMBBUTTON;
65 THUMBBUTTONLIST = ^THUMBBUTTON;
66 TThumbButton = THUMBBUTTON;
67 TThumbButtonList = array of TThumbButton;
68
69 type
70 ITaskbarList = interface
71 ['{56FDF342-FD6D-11D0-958A-006097C9A090}']
72 procedure HrInit; safecall;
73 procedure AddTab(hwnd: HWND); safecall;
74 procedure DeleteTab(hwnd: HWND); safecall;
75 procedure ActivateTab(hwnd: HWND); safecall;
76 procedure SetActiveAlt(hwnd: HWND); safecall;
77 end;
78
79 ITaskbarList2 = interface(ITaskbarList)
80 ['{602D4995-B13A-429B-A66E-1935E44F4317}']
81 procedure MarkFullscreenWindow(hwnd: HWND; fFullscreen: Bool); safecall;
82 end;
83
84 ITaskbarList3 = interface(ITaskbarList2)
85 ['{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}']
86 procedure SetProgressValue(hwnd: HWND; ullCompleted, ullTotal: ULONGLONG); safecall;
87 procedure SetProgressState(hwnd: HWND; tbpFlags: DWORD); safecall;
88 procedure RegisterTab(hwndTab: HWND; hwndMDI: HWND); safecall;
89 procedure UnregisterTab(hwndTab: HWND); safecall;
90 procedure SetTabOrder(hwndTab: HWND; hwndInsertBefore: HWND); safecall;
91 procedure SetTabActive(hwndTab: HWND; hwndMDI: HWND; tbatFlags: DWORD); safecall;
92 procedure ThumbBarAddButtons(hwnd: HWND; cButtons: UINT; Button: THUMBBUTTONLIST); safecall;
93 procedure ThumbBarUpdateButtons(hwnd: HWND; cButtons: UINT; pButton: THUMBBUTTONLIST); safecall;
94 procedure ThumbBarSetImageList(hwnd: HWND; himl: HIMAGELIST); safecall;
95 procedure SetOverlayIcon(hwnd: HWND; hIcon: HICON; pszDescription: LPCWSTR); safecall;
96 procedure SetThumbnailTooltip(hwnd: HWND; pszTip: LPCWSTR); safecall;
97 procedure SetThumbnailClip(hwnd: HWND; prcClip: PRect); safecall;
98 end;
99
100 const
101 DWM_SIT_DISPLAYFRAME = $00000001; // Display a window frame around the provided bitmap
102 DWMWA_FORCE_ICONIC_REPRESENTATION = 7; // [set] Force this window to display iconic thumbnails.
103 DWMWA_HAS_ICONIC_BITMAP = 10; // [set] Indicates an available bitmap when there is no better thumbnail representation.
104 DWMWA_DISALLOW_PEEK = 11; // [set] Don't invoke Peek on the window.
105
106 type
107 TWMDwmSendIconicLivePreviewBitmap = TWMNoParams;
108
109 TWMDwmSendIconicThumbnail = packed record
110 Msg
111 : Cardinal;
112 Unused
113 : Integer;
114 Height
115 , Width
116 : Word;
117 Result
118 : LongInt;
119 end;
120
121 function DwmInvalidateIconicBitmaps(hwnd: HWND): HRESULT;
122 function DwmSetIconicLivePreviewBitmap(hwnd: HWND; hbmp: HBITMAP; pptClient: PPoint; dwSITFlags: DWORD): HRESULT;
123 function DwmSetIconicThumbnail(hWnd: HWND; hBmp: HBITMAP; dwSITFlags: DWORD): HRESULT;
124 function DwmSetWindowAttribute(hwnd: HWND; dwAttribute: DWORD; pvAttribute: Pointer; cbAttribute: DWORD): HRESULT;
125
126 function PrintWindow(hwnd: HWND; hdcBlt: HDC; nFlags: UINT): BOOL;
127
128 implementation
129
130 var
131 hDWMAPI: HMODULE;
132 _DwmInvalidateIconicBitmaps: function(hwnd: HWND): HRESULT; stdcall;
133 _DwmSetIconicThumbnail: function(hWnd: HWND; hBmp: HBITMAP; dwSITFlags: DWORD): HRESULT; stdcall;
134 _DwmSetIconicLivePreviewBitmap: function(hwnd: HWND; hbmp: HBITMAP; pptClient: PPoint; dwSITFlags: DWORD): HRESULT; stdcall;
135 _DwmSetWindowAttribute: function(hwnd: HWND; dwAttribute: DWORD; pvAttribute: Pointer; cbAttribute: DWORD): HRESULT; stdcall;
136 _PrintWindow: function(hwnd: HWND; hdcBlt: HDC; nFlags: UINT): BOOL; stdcall;
137
138 procedure InitDwmApi;
139 begin
140 if hDWMAPI = 0 then
141 begin
142 hDWMAPI := LoadLibrary('DWMAPI.DLL');
143 if hDWMAPI = 0 then
144 begin
145 hDWMAPI := THandle(-1);
146 end
147 else
148 begin
149 _DwmInvalidateIconicBitmaps := GetProcAddress(hDWMAPI, 'DwmInvalidateIconicBitmaps');
150 _DwmSetIconicLivePreviewBitmap := GetProcAddress(hDWMAPI, 'DwmSetIconicLivePreviewBitmap');
151 _DwmSetIconicThumbnail := GetProcAddress(hDWMAPI, 'DwmSetIconicThumbnail');
152 _DwmSetWindowAttribute := GetProcAddress(hDWMAPI, 'DwmSetWindowAttribute');
153 end;
154 end;
155 end;
156
157 function DwmInvalidateIconicBitmaps(hwnd: HWND): HRESULT;
158 begin
159 InitDwmApi;
160 if Assigned(_DwmInvalidateIconicBitmaps) then
161 Result := _DwmInvalidateIconicBitmaps(hwnd)
162 else
163 Result := E_NOTIMPL;
164 end;
165
166 function DwmSetIconicLivePreviewBitmap(hwnd: HWND; hbmp: HBITMAP; pptClient: PPoint; dwSITFlags: DWORD): HRESULT;
167 begin
168 InitDwmApi;
169 if Assigned(_DwmSetIconicLivePreviewBitmap) then
170 Result := _DwmSetIconicLivePreviewBitmap(hwnd, hbmp, pptClient, dwSITFlags)
171 else
172 Result := E_NOTIMPL;
173 end;
174
175 function DwmSetIconicThumbnail(hWnd: HWND; hBmp: HBITMAP; dwSITFlags: DWORD): HRESULT;
176 begin
177 InitDwmApi;
178 if Assigned(_DwmSetIconicThumbnail) then
179 Result := _DwmSetIconicThumbnail(hWnd, hBmp, dwSITFlags)
180 else
181 Result := E_NOTIMPL;
182 end;
183
184 function DwmSetWindowAttribute(hwnd: HWND; dwAttribute: DWORD; pvAttribute: Pointer; cbAttribute: DWORD): HRESULT;
185 begin
186 InitDwmApi;
187 if Assigned(_DwmSetWindowAttribute) then
188 Result := _DwmSetWindowAttribute(hwnd, dwAttribute, pvAttribute, cbAttribute)
189 else
190 Result := E_NOTIMPL;
191 end;
192
193 {-----------------------------------------------}
194
195 function PrintWindow(hwnd: HWND; hdcBlt: HDC; nFlags: UINT): BOOL;
196 begin
197 if Assigned(_PrintWindow) then
198 begin
199 Result := _PrintWindow(hwnd, hdcBlt, nFlags);
200 end
201 else
202 begin
203 _PrintWindow := GetProcAddress(GetModuleHandle('user32.dll'), 'PrintWindow');
204 Result := Assigned(_PrintWindow) and _PrintWindow(hwnd, hdcBlt, nFlags);
205 end;
206 end;
207
208 end.