How to detect when the Windows Taskbar is moved (Views: 27)
Problem/Question/Abstract: 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 procedure WMSettingChange(var msg: TWMSettingChange); message WM_SETTINGCHANGE; procedure TForm1.WMSettingChange(var msg: TWMSettingChange); var r: TRect; begin if msg.Section <> nil then if StrIComp(msg.section, 'windows') = 0 then begin SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0); memo1.lines.add(format('Workarea is %d, %d:%d, %d', [r.left, r.top, r.right, r.bottom])); end; end; |