Delphi GetWindowRect检测bsSingle BoarderStyle

Delphi GetWindowRect检测bsSingle BoarderStyle,delphi,Delphi,对于这种boarder样式,我使用GetWindowRect: 我想得到整个窗口的坐标。感谢您的帮助此功能: uses Winapi.DwmApi; procedure TForm1.Button1Click(Sender: TObject); var R: TRect; begin if (Win32MajorVersion >= 6) and DwmCompositionEnabled then DwmGetWindowAttribute(Handle, DWM

对于这种boarder样式,我使用GetWindowRect:

我想得到整个窗口的坐标。感谢您的帮助

此功能:

uses
  Winapi.DwmApi;

procedure TForm1.Button1Click(Sender: TObject);
var
  R: TRect;
begin
  if (Win32MajorVersion >= 6) and DwmCompositionEnabled then
    DwmGetWindowAttribute(Handle, DWMWA_EXTENDED_FRAME_BOUNDS, @R, SizeOf(R))
  else
    Windows.GetWindowRect(Handle, R);
  ShowMessage(IntToStr(R.Right - R.Left))
end;

GetWindowRect检索完整的窗口。@Sertac Akyuz是一个小切口,正如您所看到的那样。@TLama我希望这个用于外部窗口too@SertacAkyuz我认为我的代码是很好的,因为当我将边框样式更改为BSSIZELABLE时,它看起来像这样,请参见:。另请看。谢谢您的编辑。如果我删除(Win32MajorVersion>=6),那么在Windows XP上DwmCompositionEnabled将导致False,对吗?