Author: Jonas Bilinkevicius
Is it possible to detect when the Windows taskbar's position has been changed
(moved or resized)? I'm sure you could just hook it and grab its messages
(ABM_...), but is there a less involved way?
Answer:
The taskbar broadcasts a WM_SETTINGCHANGE message when it changes size or position.
private
1 2 procedure WMSettingChange(var msg: TWMSettingChange); message WM_SETTINGCHANGE;
3 4 procedure TForm1.WMSettingChange(var msg: TWMSettingChange);
5 var6 r: TRect;
7 begin8 if msg.Section <> nilthen9 if StrIComp(msg.section, 'windows') = 0 then10 begin11 SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
12 memo1.lines.add(format('Workarea is %d, %d:%d, %d', [r.left, r.top, r.right,
13 r.bottom]));
14 end;
15 end;