How to link with "winver = 6.0" lazarus / 34-Windows ---------------------------------------------------------------------- Pascal · 2017-08-17 04:23 How can i link my executable with "winver = 6.0"? ---------------------------------------------------------------------- marcov · 2017-08-17 04:59 winver afaik is a macro in the (C) windows headers. We don't use the C windows headers. What are you trying to achieve exactly? ---------------------------------------------------------------------- Pascal · 2017-08-17 06:37 On Windows 10 TForm.Left, Top, Width, Height have strange values. Top/Left is not 0/0. See http://forum.lazarus.freepascal.org/index.php/topic,37918.msg25662 1.html#new If i want to position a Window to one or more of the screen edges i need the position and dimensions of the drawn window without the extended resize aware area around the window. But if this a macro/define in the c headers this will not help here I think best is to use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Windows,  DwmApi; procedure xyz;var  frame: Windows.RECT;begin  DwmGetWindowAttribute(Handle, DWMWA_EXTENDED_FRAME_BOUNDS, @frame, sizeof(Windows.RECT));  ...end; initialization  InitDwmLibrary;end. ---------------------------------------------------------------------- taazz · 2017-08-17 06:56 Quote from: Pascal on August 17, 2017, 08:37:37 amOn Windows 10 TForm.Left, Top, Width, Height have strange values. Top/Left is not 0/0. See http://forum.lazarus.freepascal.org/index.php/topic,37918.msg25662 1.html#new If i want to position a Window to one or more of the screen edges i need the position and dimensions of the drawn window without the extended resize aware area around the window. use clientrect, clientwidth and clientheight instead. Quote from: Pascal on August 17, 2017, 08:37:37 amBut if this a macro/define in the c headers this will not help here I think best is to use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Windows,  DwmApi; procedure xyz;var  frame: Windows.RECT;begin  DwmGetWindowAttribute(Handle, DWMWA_EXTENDED_FRAME_BOUNDS, @frame, sizeof(Windows.RECT));  ...end; initialization  InitDwmLibrary;end.I would use this one instead https://msdn.microsoft.com/en- us/library/windows/desktop/ms633503(v=vs.85).aspx ---------------------------------------------------------------------- Pascal · 2017-08-17 08:26 Quote from: taazz on August 17, 2017, 08:56:59 amI would use this one instead https://msdn.microsoft.com/en- us/library/windows/desktop/ms633503(v=vs.85).aspx No, that are not the positions and dimensions of the window (without extended resize areas). It's the usable inner space of the window. ---------------------------------------------------------------------- taazz · 2017-08-17 08:40 Quote from: Pascal on August 17, 2017, 10:26:16 amQuote from: taazz on August 17, 2017, 08:56:59 amI would use this one instead https://msdn.microsoft.com/en- us/library/windows/desktop/ms633503(v=vs.85).aspx No, that are not the positions and dimensions of the window (without extended resize areas). It's the usable inner space of the window. I guess the 0,0 for top left through me off then. I have no idea what the "extended resize areas" are. ---------------------------------------------------------------------- Pascal · 2017-08-17 08:51 Quote from: taazz on August 17, 2017, 10:40:39 amI guess the 0,0 for top left through me off then. I have no idea what the "extended resize areas" are. On Windows 10 you have an extended area to the left, top and bottom where the cursor changes to the resize cursor and this size is included in the window position and dimensions (equal to TForm.Left, Top, Width and Height). ---------------------------------------------------------------------- taazz · 2017-08-17 08:53 Quote from: Pascal on August 17, 2017, 10:51:12 amQuote from: taazz on August 17, 2017, 10:40:39 amI guess the 0,0 for top left through me off then. I have no idea what the "extended resize areas" are. On Windows 10 you have an extended area to the left, top and bottom where the cursor changes to the resize cursor and this size is included in the window position and dimensions (equal to TForm.Left, Top, Width and Height). isn't that called a frame/border in older windows? ---------------------------------------------------------------------- Pascal · 2017-08-17 09:03 Quote from: taazz on August 17, 2017, 10:53:15 amisn't that called a frame/border in older windows? Yes, but it doesn't look like one. The visible border is 1 pixel but the whole border is 8 pixel. I am curious how Delphi handles this (Setting window position to 0/0) on Windows 10. Will there be a visible gap of 7 pixels to left of the window? ---------------------------------------------------------------------- taazz · 2017-08-17 09:10 Quote from: Pascal on August 17, 2017, 11:03:02 amQuote from: taazz on August 17, 2017, 10:53:15 amisn't that called a frame/border in older windows? Yes, but it doesn't look like one. The visible border is 1 pixel but the whole border is 8 pixel. I am curious how Delphi handles this (Setting window position to 0/0) on Windows 10. Will there be a visible gap of 7 pixels to left of the window? Sorry I do not have access to windows 10 and I'll probably never will in the near future but that sounds like a windows bug. If my memory serves me correctly in all windows versions from 95 upwards the mouse check for the borders had an error of 1 or 2 pixels on top of the border width to make it more user friendly but that friendliness was never part of the window it self. Are you sure its not an artifact of your current theme? Are you using the default windows theme? ---------------------------------------------------------------------- Pascal · 2017-08-17 10:00 It's not a bug it's a feature  https://stackoverflow.com/questions/34139450/getwindowrect-returns-a- size-including-invisible-borders ---------------------------------------------------------------------- rvk · 2017-08-17 10:21 Quote from: Pascal on August 17, 2017, 11:03:02 amI am curious how Delphi handles this (Setting window position to 0/0) on Windows 10. Will there be a visible gap of 7 pixels to left of the window? Yes there is. ---------------------------------------------------------------------- Pascal · 2017-08-17 10:25 Quote from: rvk on August 17, 2017, 12:21:06 pmYes there is. Thanks! ---------------------------------------------------------------------- taazz · 2017-08-17 10:50 Quote from: rvk on August 17, 2017, 12:21:06 pmQuote from: Pascal on August 17, 2017, 11:03:02 amI am curious how Delphi handles this (Setting window position to 0/0) on Windows 10. Will there be a visible gap of 7 pixels to left of the window? Yes there is. Good to know! which is the Delphi version used? ---------------------------------------------------------------------- rvk · 2017-08-17 11:08 Quote from: taazz on August 17, 2017, 12:50:45 pmQuote from: rvk on August 17, 2017, 12:21:06 pmQuote from: Pascal on August 17, 2017, 11:03:02 amI am curious how Delphi handles this (Setting window position to 0/0) on Windows 10. Will there be a visible gap of 7 pixels to left of the window? Yes there is. Good to know! which is the Delphi version used? Delphi 10.1 Berlin on Windows 10 Pro 64 bit. B.T.W. for setting winver=6 you need to set the MajorSubsystemVersion, not the MajorOperatingSystemVersion, in the IMAGE_OPTIONAL_HEADER flags to 6. In Delphi you can do this by adding {$SETPESUBSYSVERSION 6.0} ( for MajorSubsystemVersion it would be {$SETPEOSVERSION 6.0} ) But both have no effect on Windows 10. (I checked with PEview that the PE-flags where really set correctly.) ---------------------------------------------------------------------- Pascal · 2017-08-17 11:32 Quote from: rvk on August 17, 2017, 01:08:30 pmB.T.W. for setting winver=6 you need to set the MajorSubsystemVersion, not the MajorOperatingSystemVersion, in the IMAGE_OPTIONAL_HEADER flags to 6. In Delphi you can do this by adding {$SETPESUBSYSVERSION 6.0} ( for MajorSubsystemVersion it would be {$SETPEOSVERSION 6.0} ) But both have no effect on Windows 10. (I checked with PEview that the PE-flags where really set correctly.) This may only affect other things: https://social.msdn.microsoft.com/Forums/windowsdesktop/en- US/6c1c67a9-5548-4e9b-989f-c7dbac0b1375/getwindowrect-on-nonresizable- windows-under-aero-glass?forum=windowsuidevelopment ---------------------------------------------------------------------- rvk · 2017-08-17 11:37 So you can do something like this (like you mentioned) but it's far from optimal. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses Windows, dwmapi; function GetRealWindowRect(Handle: HWND; var R: TRect): Boolean;begin  Result := (GetParent(Handle) = 0) and DwmCompositionEnabled and    (DwmGetWindowAttribute(Handle, DWMWA_EXTENDED_FRAME_BOUNDS, @R, SizeOf(R)) = S_OK);  if not Result then    Result := GetWindowRect(Handle, R);end; function GetInvisibleBorder(Handle: Hwnd): Integer;var  R1, R2: TRect;begin  Result := 0;  if GetRealWindowRect(Handle, R1) and GetWindowRect(Handle, R2) then  begin    Result := R1.Left - R2.Left;  end;end; procedure TForm1.FormCreate(Sender: TObject);begin  InitDwmLibrary;  Top := 0;  Left := 0;end; procedure TForm1.FormActivate(Sender: TObject);begin  Left := 0 - GetInvisibleBorder(Handle); // only possible after window is visibleend;