'How to detect that Taskbar Thumbnail Preview is being drawn when DWMWA_HAS_ICONIC_BITMAP is set
How to detect that Taskbar Thumbnail Preview is being drawn (because user is moving mouse over taskbar button) or is currently appearing on screen?
Why the code below does not make log entries when WM_DWMSENDICONICTHUMBNAIL msg should be arriving to form?
procedure TStartInfoForm.FormCreate(Sender: TObject);
begin
SetWindowAttribute(DWMWA_HAS_ICONIC_BITMAP);
end;
function TStartInfoForm.SetWindowAttribute(dwAttr: DWORD): HRESULT;
var
Attr: function(hwnd: hwnd; dwAttribute: DWORD; pvAttribute: Pointer;
cbAttribute: DWORD): HRESULT; stdcall;
hndDLLHandle : THandle;
EnableAttribute : DWORD;
begin
EnableAttribute := DWORD(true);
try
hndDLLHandle := loadLibrary('dwmapi.dll');
if hndDLLHandle <> 0 then
begin
Attr := getProcAddress(hndDLLHandle, 'DwmSetWindowAttribute');
if addr(Attr) <> nil then
Result := Attr(Handle, dwAttr, @EnableAttribute, SizeOf(EnableAttribute));
end;
finally
freeLibrary(hndDLLHandle);
end;
end;
procedure TStartInfoForm.WndProc(var Msg : TMessage);
begin
DebugNote(0,'wndproc '+inttohex(msg.Msg,3)+' w '+inttohex(Msg.wparam,3)+' l '+inttohex(Msg.lparam,3));
case Msg.Msg of
WM_DWMSENDICONICTHUMBNAIL :
begin
DebugNote(0,' iconiclive');
end;
WM_DWMSENDICONICLIVEPREVIEWBITMAP:
begin
DebugNote(0,' iconiclive2 ');
end;
WM_WINDOWPOSCHANGING:
begin
// MessageBeep(1);
end ;
WM_WINDOWPOSCHANGED:
begin
// MessageBeep(1);
end
end;
inherited;// call this for default behaveour
end;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
