This commit is contained in:
Alexey 2021-10-27 22:03:32 +03:00
parent 33df1460d5
commit b689a8da81
24 changed files with 97 additions and 95 deletions

View File

@ -318,8 +318,6 @@ end;
// The original function was about 2400 lines.
type
TAccessCustomEdit = class(TCustomEdit);
{ TWindowProcHelper }
TWindowProcHelper = record
@ -695,7 +693,7 @@ begin
end;
if ParentPaintWindow <> 0 then
GetWin32ControlPos(Window, ParentPaintWindow, parLeft, parTop);
GetWin32ControlPos(Window, ParentPaintWindow, parLeft{%H-}, parTop{%H-});
//Is not necessary to check the result of GetLCLClientBoundsOffset since
//the false condition (lWincontrol = nil or lWincontrol <> TWinControl) is never met
//The rect is always initialized with 0
@ -1133,11 +1131,11 @@ begin
C := DragQueryFile(Drop, $FFFFFFFF, nil, 0); // get dropped files count
if C <= 0 then Exit;
SetLength(Files, C);
SetLength(Files{%H-}, C);
for I := 0 to C - 1 do
begin
L := DragQueryFileW(Drop, I, nil, 0); // get I. file name length
SetLength(WideBuffer, L);
SetLength(WideBuffer{%H-}, L);
L := DragQueryFileW(Drop, I, @WideBuffer[1], L + 1);
SetLength(WideBuffer, L);
Files[I] := UTF16ToUTF8(WideBuffer);
@ -1907,7 +1905,7 @@ begin
LMMove.Msg := LM_NULL;
end else
begin
if GetWindowRelativePosition(Window, NewLeft, NewTop) then
if GetWindowRelativePosition(Window, NewLeft{%H-}, NewTop{%H-}) then
UpdateLMMovePos(NewLeft, NewTop)
else
LMMove.Msg := LM_NULL;
@ -1956,7 +1954,7 @@ begin
SizeType := SIZE_RESTORED or Size_SourceIsInterface;
end;
GetWindowSize(Window, NewWidth, NewHeight);
GetWindowSize(Window, NewWidth{%H-}, NewHeight{%H-});
Width := NewWidth;
Height := NewHeight;
if Assigned(lWinControl) then
@ -2038,7 +2036,7 @@ begin
if (LastMouseTracking<>lWinControl) then
begin
// register for WM_MOUSELEAVE
FillChar(LMouseEvent, SizeOf(TTRACKMOUSEEVENT), 0);
FillChar(LMouseEvent{%H-}, SizeOf(TTRACKMOUSEEVENT), 0);
LMouseEvent.cbSize := SizeOf(TTRACKMOUSEEVENT);
LMouseEvent.dwFlags := TME_LEAVE;
LMouseEvent.hwndTrack := Window;
@ -2762,7 +2760,7 @@ function
var
Helper: TWindowProcHelper;
begin
FillChar(Helper, SizeOf(TWindowProcHelper), 0);
FillChar(Helper{%H-}, SizeOf(TWindowProcHelper), 0);
Helper.Window := Window;
Helper.Msg := Msg;
Helper.WParam := WParam;
@ -2856,7 +2854,7 @@ begin
if (Int16(LoWord(LParam)) <> 0) or (Int16(HiWord(LParam)) <> 0) then
begin
Parent := Windows.GetParent(Window);
Windows.GetClientRect(Parent, LRect);
Windows.GetClientRect(Parent, LRect{%H-});
Windows.SetWindowPos(Window, HWND_TOP, 0, 0, LRect.Right, LRect.Bottom, 0);
end;
end;

View File

@ -26,7 +26,7 @@ unit Win32Extra;
interface
uses
InterfaceBase, Classes, LCLType, Windows, GraphType, SysUtils, ActiveX, ShlObj;
Classes, LCLType, Windows, GraphType, SysUtils, ActiveX, ShlObj;
{ Win32 API constants not included in windows.pp }
const
@ -515,7 +515,7 @@ begin
SrcLineOrder := GetBitmapOrder(SrcSection.dsBm, SrcBmp);
// setup info shared by alpha, source and destination bytes
FillChar(Info, sizeof(Info), 0);
FillChar(Info{%H-}, sizeof(Info), 0);
Info.Header.biSize := sizeof(Windows.TBitmapInfoHeader);
Info.Header.biWidth := nWidthDest;
if SrcLineOrder = riloBottomToTop
@ -551,7 +551,7 @@ begin
Info.Header.biSizeImage := nWidthSrc * nHeightSrc * 4;
// create temp bitmap to store orginal grayscale alpha
TmpBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, TmpBytesPtr, 0, 0);
TmpBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, TmpBytesPtr{%H-}, 0, 0);
if TmpBmp = 0 then Exit(False);
if TmpBytesPtr = nil
then begin
@ -582,7 +582,7 @@ begin
Info.Header.biSizeImage := nWidthDest * nHeightDest * 4;
// create bitmap to store stretched grayscale alpha
AlphaBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, AlphaBytesPtr, 0, 0);
AlphaBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, AlphaBytesPtr{%H-}, 0, 0);
if (AlphaBmp = 0) or (AlphaBytesPtr = nil)
then begin
FreeMem(SrcBytesPtr);
@ -668,7 +668,7 @@ begin
or (DstSection.dsBmih.biCompression <> BI_RGB)
then begin
// create temp dib
DstBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, DstBytesPtr, 0, 0);
DstBmp := CreateDIBSection(hdcSrc, PBitmapInfo(@Info)^, DIB_RGB_COLORS, DstBytesPtr{%H-}, 0, 0);
// copy destination
DC := CreateCompatibleDC(hdcDest);
OldBmp := SelectObject(DC, DstBmp);

View File

@ -151,7 +151,7 @@ var
lProcessEvent: PProcessEvent absolute AData;
exitcode: dword;
begin
if not Windows.GetExitCodeProcess(lProcessEvent^.Handle, exitcode) then
if not Windows.GetExitCodeProcess(lProcessEvent^.Handle, exitcode{%H-}) then
exitcode := 0;
lProcessEvent^.OnEvent(lProcessEvent^.UserData, cerExit, exitcode);
end;
@ -259,7 +259,7 @@ var
begin
WndClassName := 'LazRubberBand' + IntToStr(ABrush);
if not Windows.GetClassInfo(System.HInstance, PChar(WndClassName), WindowClass) then
if not Windows.GetClassInfo(System.HInstance, PChar(WndClassName), WindowClass{%H-}) then
begin
with WindowClass do
begin
@ -701,7 +701,7 @@ begin
//Issue #0027664
if (WindowsVersion >= wvVista) and (GetFileVersion(comctl32) >= ComCtlVersionIE6) then
begin
FillChar(TaskConfig, SizeOf(TaskConfig), 0);
FillChar(TaskConfig{%H-}, SizeOf(TaskConfig), 0);
TaskConfig.cbSize := SizeOf(TaskConfig);
// if we skip hwndParent our form will be a root window - with the taskbar item and icon
// this is unwanted
@ -815,7 +815,7 @@ var
then DstBpp := 24
else DstBpp := ADesc.BitsPerPixel;
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.Header.biSize := SizeOf(Info.Header);
Info.Header.biWidth := ADesc.Width;
if ADesc.LineOrder = riloTopToBottom
@ -832,7 +832,7 @@ var
// Use createDIBSection, since only devicedepth bitmaps can be selected into a DC
// when they are created with createDIBitmap
// ABitmap := Windows.CreateDIBitmap(DC, Info.Header, CBM_INIT, ARawImage.Data, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS);
ABitmap := Windows.CreateDIBSection(DC, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS, DstLinePtr, 0, 0);
ABitmap := Windows.CreateDIBSection(DC, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS, DstLinePtr{%H-}, 0, 0);
Windows.ReleaseDC(0, DC);
if ABitmap = 0
@ -1010,7 +1010,7 @@ var
R: TRect;
begin
ARawImage.Init;
FillChar(WinDIB, SizeOf(WinDIB), 0);
FillChar(WinDIB{%H-}, SizeOf(WinDIB), 0);
ASize := Windows.GetObject(ABitmap, SizeOf(WinDIB), @WinDIB);
if ASize = 0
then Exit(False);
@ -1100,7 +1100,7 @@ begin
if h = 0
then h := Windows.GetDeviceCaps(ADC, VERTRES);
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.Header.biSize := SizeOf(Info.Header);
Info.Header.biWidth := w;
Info.Header.biHeight := -h;
@ -1108,7 +1108,7 @@ begin
Info.Header.biBitCount := Windows.GetDeviceCaps(ADC, BITSPIXEL);
Info.Header.biCompression := BI_RGB;
copyBmp := Windows.CreateDIBSection(copyDC, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS, BitsPtr, 0, 0);
copyBmp := Windows.CreateDIBSection(copyDC, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS, BitsPtr{%H-}, 0, 0);
copyOld := Windows.SelectObject(copyDC, copyBmp);
// prefill bitmap, to create an alpha channel in case of 32bpp bitmap

View File

@ -153,7 +153,7 @@ begin
raise Exception.Create('Out of bounds.')
else
begin
SetLength(w, Windows.SendMessageW(FWin32List, FFlagGetTextLen, Index, 0));
SetLength(w{%H-}, Windows.SendMessageW(FWin32List, FFlagGetTextLen, Index, 0));
Windows.SendMessageW(FWin32List, FFlagGetText, Index, LPARAM(PWideChar(w)));
Result := UTF16ToUTF8(w);
end;
@ -327,7 +327,7 @@ begin
if Source is TStrings then
begin
// save text in edit box, assigning strings clears the text
TWin32WSCustomComboBox.GetText(FSender, EditText);
TWin32WSCustomComboBox.GetText(FSender, EditText{%H-});
inherited Assign(Source);

View File

@ -72,7 +72,7 @@ begin
Result := '';
exit;
end;
Setlength(WideBuffer, len);
Setlength(WideBuffer{%H-}, len);
PWord(@WideBuffer[1])^ := len+1;
len := SendMessageW(FHandle, EM_GETLINE, Index, lparam(PWideChar(WideBuffer)));
Result := UTF16ToUTF8(WideBuffer);
@ -168,7 +168,7 @@ begin
if (AdjustedValue <> Text) then
begin
Windows.SetWindowTextW(FHandle, PWideChar(UTF8ToUTF16(AdjustedValue)));
FillChar(Msg, SizeOf(Msg), 0);
FillChar(Msg{%H-}, SizeOf(Msg), 0);
Msg.Msg := CM_TEXTCHANGED;
DeliverMessage(Owner, Msg);
end;

View File

@ -400,7 +400,7 @@ begin
end else
if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
begin
while PeekMessage(AMessage, HWnd(nil), 0, 0, PM_REMOVE) do
while PeekMessage(AMessage{%H-}, HWnd(nil), 0, 0, PM_REMOVE) do
begin
if AMessage.message = WM_QUIT then
begin
@ -654,7 +654,7 @@ procedure TWin32WidgetSet.UpdateMDIClientBounds;
var
I: Integer;
begin
Windows.GetClientRect(Application.MainFormHandle, Result);
Windows.GetClientRect(Application.MainFormHandle, Result{%H-});
for I := 0 to Application.MainForm.ControlCount - 1 do
if Application.MainForm.Controls[I].Visible then
case Application.MainForm.Controls[I].Align of

View File

@ -564,7 +564,7 @@ begin
WinHandle := ATabControl.Handle;
// Adjust page size to fit in tabcontrol, need bounds of tab control in client of parent
TWin32WidgetSet(WidgetSet).GetClientRect(WinHandle, R);
TWin32WidgetSet(WidgetSet).GetClientRect(WinHandle, R{%H-});
for I := 0 to ATabControl.PageCount - 1 do
begin
lPage := ATabControl.Page[I];
@ -599,9 +599,9 @@ var
Mess: TLMNotify;
NMHdr: tagNMHDR;
begin
FillChar(Mess,SizeOf(Mess),0);
FillChar(Mess{%H-},SizeOf(Mess),0);
Mess.Msg := LM_NOTIFY;
FillChar(NMHdr,SizeOf(NMHdr),0);
FillChar(NMHdr{%H-},SizeOf(NMHdr),0);
NMHdr.code := TCN_SELCHANGE;
NMHdr.hwndfrom := AHandle;
NMHdr.idfrom := APageIndex; //use this to set pageindex to the correct page.

View File

@ -645,7 +645,7 @@ var
IntfWidth, IntfHeight: integer;
begin
Result := False;
LCLIntf.GetWindowSize(Sender.Handle, IntfWidth, IntfHeight);
LCLIntf.GetWindowSize(Sender.Handle, IntfWidth{%H-}, IntfHeight{%H-});
if (Sender.Width = IntfWidth) and (Sender.Height = IntfHeight) and (not Sender.ClientRectNeedsInterfaceUpdate) then
Exit;
Result := True;
@ -689,7 +689,7 @@ begin
if not (Sender is TWinControl) then exit;
if not TheWinControl.HandleAllocated then exit;
Handle := TheWinControl.Handle;
FillChar(ORect, SizeOf(ORect), 0);
FillChar(ORect{%H-}, SizeOf(ORect), 0);
if TheWinControl is TScrollingWinControl then
begin
{$ifdef RedirectDestroyMessages}
@ -723,7 +723,7 @@ begin
// add the upper frame with the caption
DC := Windows.GetDC(Handle);
SelectObject(DC, TheWinControl.Font.Reference.Handle);
Windows.GetTextMetrics(DC, TM);
Windows.GetTextMetrics(DC, TM{%H-});
ORect.Top := TM.TMHeight + 3;
Windows.ReleaseDC(Handle, DC);
// add the left, right and bottom frame borders
@ -778,8 +778,8 @@ procedure GetWin32ControlPos(Window, Parent: HWND; var Left, Top: integer);
var
parRect, winRect: Windows.TRect;
begin
Windows.GetWindowRect(Window, winRect);
Windows.GetWindowRect(Parent, parRect);
Windows.GetWindowRect(Window, winRect{%H-});
Windows.GetWindowRect(Parent, parRect{%H-});
Left := winRect.Left - parRect.Left;
Top := winRect.Top - parRect.Top;
end;
@ -1048,7 +1048,7 @@ begin
oldFontHandle := SelectObject(canvasHandle, newFontHandle);
DeleteAmpersands(Text);
Result := LCLIntf.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize);
Result := LCLIntf.GetTextExtentPoint32(canvasHandle, PChar(Text), Length(Text), textSize{%H-});
if Result then
begin
@ -1070,7 +1070,7 @@ var
WideBuffer: WideString;
begin
TextLen := Windows.GetWindowTextLengthW(AHandle);
SetLength(WideBuffer, TextLen);
SetLength(WideBuffer{%H-}, TextLen);
if TextLen > 0 // Never give Windows the chance to write to System.emptychar
then TextLen := Windows.GetWindowTextW(AHandle, PWideChar(WideBuffer), TextLen + 1);
SetLength(WideBuffer, TextLen);
@ -1193,7 +1193,7 @@ begin
then ScanLine := GetMem(AWinBmp.bmWidthBytes)
else ScanLine := nil;
FillChar(Info.Header, sizeof(Windows.TBitmapInfoHeader), 0);
FillChar({%H-}Info.Header, sizeof(Windows.TBitmapInfoHeader), 0);
Info.Header.biSize := sizeof(Windows.TBitmapInfoHeader);
DC := Windows.GetDC(0);
if Windows.GetDIBits(DC, ABitmap, 0, 1, nil, Windows.PBitmapInfo(@Info)^, DIB_RGB_COLORS) = 0
@ -1326,7 +1326,7 @@ function IsAlphaBitmap(ABitmap: HBITMAP): Boolean;
var
Info: Windows.BITMAP;
begin
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Result := (GetObject(ABitmap, SizeOf(Info), @Info) <> 0)
and (Info.bmBitsPixel = 32);
end;

View File

@ -212,7 +212,7 @@ begin
idDialogConfirm: IconHandle := LoadImage(0, IDI_QUESTION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE or LR_SHARED);
idDialogShield:
begin
FillChar(SHIconInfo, SizeOf(SHIconInfo), 0);
FillChar(SHIconInfo{%H-}, SizeOf(SHIconInfo), 0);
SHIconInfo.cbSize := SizeOf(SHIconInfo);
if (SHGetStockIconInfo(SIID_SHIELD, SHGFI_ICON or SHGFI_LARGEICON, @SHIconInfo) = S_OK) then
IconHandle := SHIconInfo.hIcon
@ -291,7 +291,7 @@ begin
begin
w := UTF8ToUTF16(S);
GetThemeTextExtent(Theme[Element], DC, Part, State, PWideChar(W), Length(W),
Flags, BoundingRect, Result);
Flags, BoundingRect, Result{%H-});
end
else
Result := inherited GetTextExtent(DC, Details, S, Flags, BoundingRect);
@ -432,7 +432,7 @@ begin
ExStyle := GetWindowLong(Handle, GWL_EXSTYLE);
if (ExStyle and WS_EX_CLIENTEDGE) <> 0 then
begin
GetWindowRect(Handle, DrawRect);
GetWindowRect(Handle, DrawRect{%H-});
OffsetRect(DrawRect, -DrawRect.Left, -DrawRect.Top);
DC := GetWindowDC(Handle);
try

View File

@ -159,7 +159,7 @@ var
WideBuffer: widestring;
begin
// Fill TNotifyIconDataW
FillChar(tnidw, SizeOf(tnidw), 0);
FillChar(tnidw{%H-}, SizeOf(tnidw), 0);
tnidw.cbSize := SizeOf(tnidw);
tnidw.hWnd := ATrayIcon.Handle;
tnidw.uID := uIDTrayIcon;
@ -197,7 +197,7 @@ var
tnid: TNotifyIconData;
begin
// Fill TNotifyIconData
FillChar(tnid, SizeOf(tnid), 0);
FillChar(tnid{%H-}, SizeOf(tnid), 0);
tnid.cbSize := SizeOf(TNotifyIconData);
tnid.hWnd := ATrayIcon.Handle;
tnid.uID := uIDTrayIcon;
@ -270,7 +270,7 @@ var
WideBuffer: widestring;
begin
// Fill TNotifyIconDataW
FillChar(tnidw, SizeOf(tnidw), 0);
FillChar(tnidw{%H-}, SizeOf(tnidw), 0);
tnidw.cbSize := SizeOf(tnidw);
tnidw.hWnd := ATrayIcon.Handle;
tnidw.uID := uIDTrayIcon;

View File

@ -54,7 +54,7 @@ begin
if Angle16DegLength < 0 then OldArcDirection := Windows.SetArcDirection(DC, AD_CLOCKWISE)
else OldArcDirection := Windows.SetArcDirection(DC, AD_COUNTERCLOCKWISE);
Angles2Coords(Left, Top, Right - Left, Bottom - Top, Angle16Deg, Angle16DegLength, SX, SY, EX, EY);
Angles2Coords(Left, Top, Right - Left, Bottom - Top, Angle16Deg, Angle16DegLength, SX{%H-}, SY{%H-}, EX{%H-}, EY{%H-});
Result := Boolean(Windows.Arc(DC, Left, Top, Right, Bottom, SX, SY, EX, EY));
// Revert the arc direction to the previous value
Windows.SetArcDirection(DC, OldArcDirection);
@ -77,7 +77,7 @@ function TWin32WidgetSet.AngleChord(DC: HDC; x1, y1, x2, y2, angle1,
var
SX, SY, EX, EY : Longint;
begin
Angles2Coords(x1, y1, x2-x1, y2-y1, Angle1, Angle2, SX, SY, EX, EY);
Angles2Coords(x1, y1, x2-x1, y2-y1, Angle1, Angle2, SX{%H-}, SY{%H-}, EX{%H-}, EY{%H-});
Result := Boolean(Windows.Chord(DC, x1, y1, x2, y2, SX, SY, EX, EY));
end;
@ -181,7 +181,7 @@ var
SystemWParam := Windows.WParam(Longint(PointToSmallPointNoChecks(Pos)));
// send scroll message
FillChar(ScrollInfo, sizeof(ScrollInfo), #0);
FillChar(ScrollInfo{%H-}, sizeof(ScrollInfo), #0);
ScrollInfo.cbSize := sizeof(ScrollInfo);
ScrollInfo.fMask := SIF_PAGE or SIF_POS or SIF_RANGE;
// if mouse is over horizontal scrollbar, scroll horizontally
@ -437,7 +437,7 @@ begin
BufferStream.Position := 0;
if FormatID=Windows.CF_UNICODETEXT then
begin;
SetLength(BufferWideString, Size div 2);
SetLength(BufferWideString{%H-}, Size div 2);
BufferStream.Read(BufferWideString[1], Size);
//BufferString may have pending #0 's (or garbage after a #0)
Size := Pos(#0, BufferWideString);
@ -605,7 +605,7 @@ function TWin32WidgetSet.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
// we need to convert it from UTF8 to UTF16 or Ansi
begin
if DataStream.Size>0 then begin
SetLength(BufferString, DataStream.Size);
SetLength(BufferString{%H-}, DataStream.Size);
DataStream.Read(BufferString[1], DataStream.Size);
if FormatID=Windows.CF_UNICODETEXT then
begin
@ -1340,6 +1340,7 @@ var
Rec: PProcRedirRec absolute Data;
ALogFont: TEnumLogFontExA;
begin
FillChar(ALogFont{%H-}, SizeOf(ALogFont), 0);
Move(ELogFont.elfLogFont, ALogFont.elfLogFont, SizeOf(ALogFont.elfLogFont) - SizeOf(ALogFont.elfLogFont.lfFaceName));
ALogFont.elfLogFont.lfFaceName := UTF16ToUTF8(ELogFont.elfLogFont.lfFaceName);
ALogFont.elfFullName := UTF16ToUTF8(ELogFont.elfFullName);
@ -1532,7 +1533,7 @@ begin
nIndex := SFindFirstCharSurrogate(W);
if nIndex > 0 then
begin
SConvertDxArrayFromUTF8ToWide(W, Dx, Count, DxWide, nIndex);
SConvertDxArrayFromUTF8ToWide(W, Dx, Count, DxWide{%H-}, nIndex);
Result := Windows.ExtTextOutW(DC, X, Y, Options, LPRECT(Rect), PWideChar(W), Length(W), @DxWide[0]);
Exit;
end;
@ -1856,7 +1857,7 @@ begin
// there is no way to get offset for memory or metafile DC => assume it 0
Result := GetObjectType(PaintDC) = OBJ_DC;
if not Result then Exit;
Result := Windows.GetDCOrgEx(PaintDC, DCOrg);
Result := Windows.GetDCOrgEx(PaintDC, DCOrg{%H-});
if not Result then Exit;
winOrg.X := 0;
winOrg.Y := 0;
@ -1898,7 +1899,7 @@ begin
hWindow := WindowFromDC(DC);
if hWindow <> HWND(nil) then
begin
Result := GetClientRect(hWindow, ClientRect);
Result := GetClientRect(hWindow, ClientRect{%H-});
P.x := ClientRect.Right;
P.y := ClientRect.Bottom;
end;
@ -2432,7 +2433,7 @@ begin
// maximized or aero snap windows will have problems
if (GetWindowLong(Handle, GWL_STYLE) and WS_CHILD = 0) then
begin
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.cbSize := SizeOf(Info);
Result := GetWindowInfo(Handle, @Info);
if Result then
@ -3679,7 +3680,7 @@ function TWin32WidgetSet.StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Intege
Result := HasAlphaN or (HasAlpha0 and HasAlpha255);
if Result
then begin
FillChar(Header, SizeOf(Header), 0);
FillChar(Header{%H-}, SizeOf(Header), 0);
Header.biSize := SizeOf(Header);
Header.biWidth := AWinBmp.bmWidth;
Header.biHeight := -AWinBmp.bmHeight;

View File

@ -71,7 +71,10 @@ uses
Win32Int, Win32Proc;
type
TBitBtnAceess = class(TCustomBitBtn)
TBitBtnAccess = class(TBitBtn)
end;
TCustomBitBtnAccess = class(TCustomBitBtn)
end;
{ TWin32WSBitBtn }
@ -97,7 +100,7 @@ function Create32BitHBitmap(ADC: HDC; AWidth, AHeight: Integer; out BitsPtr: Poi
var
Info: Windows.TBitmapInfo;
begin
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.bmiHeader.biSize := SizeOf(Info.bmiHeader);
Info.bmiHeader.biWidth := AWidth;
Info.bmiHeader.biHeight := -AHeight; // top down
@ -173,9 +176,10 @@ var
OldBitmapHandle := SelectObject(hdcNewBitmap, NewBitmap);
if UseThemes and AlphaDraw then
begin
FillChar(PaintParams, SizeOf(PaintParams), 0);
FillChar(PaintParams{%H-}, SizeOf(PaintParams), 0);
PaintParams.cbSize := SizeOf(PaintParams);
PaintParams.dwFlags := BPPF_ERASE;
TmpDC := 0;
PaintBuffer := BeginBufferedPaint(hdcNewBitmap, @BitmapRect, BPBF_COMPOSITED, @PaintParams, TmpDC);
end
else
@ -202,7 +206,7 @@ var
begin
if (srcWidth <> 0) and (srcHeight <> 0) then
begin
TBitBtnAceess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(AState, BitBtn.Font.PixelsPerInch, 1,
TCustomBitBtnAccess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(AState, BitBtn.Font.PixelsPerInch, 1,
AImageRes, AIndex, AEffect);
TWin32WSCustomImageListResolution.DrawToDC(
AImageRes.Resolution,
@ -220,7 +224,7 @@ var
if (srcWidth <> 0) and (srcHeight <> 0) then
begin
TBitBtnAceess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(AState, BitBtn.Font.PixelsPerInch, 1,
TCustomBitBtnAccess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(AState, BitBtn.Font.PixelsPerInch, 1,
AImageRes, AIndex, AEffect);
if UseThemes and not AlphaDraw then
begin
@ -261,7 +265,7 @@ var
else
begin
Details := ThemeServices.GetElementDetails(StateToDetail[AState]);
FillChar(Options, SizeOf(Options), 0);
FillChar(Options{%H-}, SizeOf(Options), 0);
Options.dwSize := SizeOf(Options);
Options.dwFlags := DTT_COMPOSITED;
TextFlags := DT_SINGLELINE;
@ -300,7 +304,7 @@ begin
if BitBtn.CanShowGlyph(True) then
begin
TBitBtnAceess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(Low(TButtonState), BitBtn.Font.PixelsPerInch, 1,
TCustomBitBtnAccess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(Low(TButtonState), BitBtn.Font.PixelsPerInch, 1,
AImageRes, AIndex, AEffect);
srcWidth := AImageRes.Width;
srcHeight := AImageRes.Height;
@ -317,7 +321,7 @@ begin
BitBtnLayout := BidiAdjustButtonLayout(BitBtn.UseRightToLeftReading, BitBtn.Layout);
BitBtnDC := GetDC(BitBtnHandle);
hdcNewBitmap := CreateCompatibleDC(BitBtnDC);
MeasureText(BitBtn, ButtonCaption, TextSize.cx, TextSize.cy);
MeasureText(BitBtn, ButtonCaption, {%H-}TextSize.cx, {%H-}TextSize.cy);
// calculate size of new bitmap
case BitBtnLayout of
blGlyphLeft, blGlyphRight:
@ -590,7 +594,7 @@ begin
begin
if BitBtn.CanShowGlyph(True) then
begin
TBitBtnAceess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(Low(TButtonState), BitBtn.Font.PixelsPerInch, 1,
TBitBtnAccess(BitBtn).FButtonGlyph.GetImageIndexAndEffect(Low(TButtonState), BitBtn.Font.PixelsPerInch, 1,
AImageRes, AIndex, AEffect);
srcWidth := AImageRes.Width;
if BitBtn.Spacing = -1 then

View File

@ -58,7 +58,7 @@ type
implementation
uses
Win32Int, InterfaceBase;
Win32Int;
{ TWin32WSCustomCalendar }
@ -149,7 +149,7 @@ begin
Result := cpNoWhere;
if not WSCheckHandleAllocated(ACalendar, 'TWin32WSCustomCalendar.HitTest') then
Exit;
FillChar(HitTestInfo, SizeOf(HitTestInfo), 0);
FillChar(HitTestInfo{%H-}, SizeOf(HitTestInfo), 0);
//the MCHITTESTINFO structure not only depends on Windows version but also on wether or not
//the application has a Manifest (Issue #0029975)
if (WindowsVersion >= wvVista) and HasManifest then
@ -160,7 +160,7 @@ begin
{$ifdef debug_win32calendar}
if IsConsole then writeln(' HitTestInfo.cbSize = ',HitTestInfo.cbSize);
{$endif}
HitPart := SendMessage(ACalendar.Handle, MCM_HITTEST, 0, LPARAM(@HitTestInfo));
HitPart := SendMessage(ACalendar.Handle, MCM_HITTEST, 0, {%H-}LPARAM(@HitTestInfo));
{$ifdef debug_win32calendar}
//if IsConsole then writeln('TWin32WSCustomCalendar.HitTest: Handle = ',IntToHex(ACalendar.Handle,8));
if IsConsole then writeln(' APoint = (',APoint.x,',',APoint.y,'), pt = (',HitTestInfo.pt.x,',',HitTestInfo.pt.y,')');
@ -232,7 +232,7 @@ begin
Exit;
if ADayOfWeek = dowDefault then begin
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, PWideChar(tmp), SizeOf(tmp));
dow := StrToInt(tmp[0]);
dow := StrToInt(char(ord(tmp[0])));
end else
dow := ord(ADayOfWeek);
MonthCal_SetFirstDayOfWeek(ACalendar.Handle, dow);

View File

@ -315,7 +315,7 @@ begin
DebugLn(['Failed to create win32 control, error: ', AErrorCode, ' : ', GetLastErrorText(AErrorCode)]);
raise Exception.Create('Failed to create win32 control, error: ' + IntToStr(AErrorCode) + ' : ' + GetLastErrorText(AErrorCode));
end;
GetWindowRect(PreferredSizeStatusBar, R);
GetWindowRect(PreferredSizeStatusBar, R{%H-});
PreferredStatusBarHeight := R.Bottom - R.Top;
DestroyWindow(PreferredSizeStatusBar);
end;

View File

@ -272,7 +272,7 @@ begin
if GetTextExtentPoint32W(ALV.Canvas.Handle,
PWideChar(UTF8ToUTF16(ALV.Column[AIndex].Caption)),
UTF8Length(ALV.Column[AIndex].Caption),
CaptionSize) then
CaptionSize{%H-}) then
begin
// to retrieve the column width that can contain the string without
// truncating it, you must add padding to the returned string width
@ -500,7 +500,7 @@ begin
then Exit;
Hdr := ListView_GetHeader(ALV.Handle);
FillChar(itm, sizeof(itm),0);
FillChar(itm{%H-}, sizeof(itm),0);
itm.mask := HDI_FORMAT;
Header_GetItem(Hdr, AIndex, Itm);
case AAndicator of
@ -1132,8 +1132,8 @@ begin
hwndHeader := GetHeader(AHandle);
if hwndHeader = 0 then Exit; // nothing to do
Windows.GetClientRect(AHandle, rc);
FillChar(hdLayout, SizeOf(hdLayout), 0);
Windows.GetClientRect(AHandle, rc{%H-});
FillChar(hdLayout{%H-}, SizeOf(hdLayout), 0);
hdLayout.prc := @rc;
hdLayout.pwpos := @wpos;
Header_Layout(hwndHeader, hdLayout);
@ -1397,7 +1397,7 @@ begin
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
then Exit;
ListView_GetOrigin(ALV.Handle, Origin);
ListView_GetOrigin(ALV.Handle, Origin{%H-});
dx := AValue.X - Origin.X;
dy := AValue.Y - Origin.Y;

View File

@ -351,7 +351,7 @@ var
begin
if (H <> 0) and (Msg = WM_InitDialog) then
begin
ws := TColorDialog(PChooseColor(L)^.lCustData).Title;
ws := WideString(TColorDialog(PChooseColor(L)^.lCustData).Title);
SetWindowTextW(H, PWideChar(ws));
end;
Result := 0;
@ -881,7 +881,7 @@ begin
I := 0;
while I < Count do
begin
if Succeeded(ShellItems.GetItemAt(I, ShellItem)) then
if Succeeded(ShellItems.GetItemAt(I, ShellItem{%H-})) then
AOpenDialog.Files.Add(GetFileName(ShellItem));
inc(I);
end;
@ -1128,7 +1128,7 @@ begin
begin
//debugln(['FontDialogCallBack: WM_INITDIALOG']);
//debugln([' PChooseFontW(LParam)^.lCustData=',IntToHex(PChooseFontW(LParam)^.lCustData,8)]);
PtrInt(Dlg) := PChooseFontW(LParam)^.lCustData;
Dlg := Pointer(PChooseFontW(LParam)^.lCustData);
end;
WM_COMMAND:
begin

View File

@ -30,10 +30,9 @@ uses
// rtl
Windows, CommCtrl, SysUtils, Classes,
// lcl
ExtCtrls, Controls, ImgList, LCLType, LCLIntf, LazUTF8, Themes, LCLMessageGlue, ComCtrls, WSComCtrls,
ExtCtrls, Controls, ImgList, LCLType, LCLIntf, LazUTF8, Themes, ComCtrls,
// ws
WSControls, WSExtCtrls, WSLCLClasses, WSProc, Win32Extra, Win32Int, Win32Proc,
InterfaceBase, Win32WSControls;
WSExtCtrls, WSLCLClasses, Win32Extra, Win32Int, Win32Proc;
type
{ TWin32WSPage }

View File

@ -116,10 +116,10 @@ begin
// attach our child to the template window
AControl.ParentWindow := hWnd;
GetWindowRect(stc32Handle, ARect);
GetWindowRect(stc32Handle, ARect{%H-});
ScreenToClient(hWnd, ARect.TopLeft);
ScreenToClient(hWnd, ARect.BottomRight);
GetClientRect(hWnd, ADialogRect);
GetClientRect(hWnd, ADialogRect{%H-});
with ARect do
begin

View File

@ -646,7 +646,7 @@ begin
// if position is default it will be changed to designed. We do not want this.
if wcfInitializing in TWinControlAccess(AWinControl).FWinControlFlags then
begin
if GetWindowRect(AForm.Handle, CurRect) then
if GetWindowRect(AForm.Handle, CurRect{%H-}) then
begin
if AForm.Position in [poDefault, poDefaultPosOnly] then
begin

View File

@ -114,7 +114,7 @@ class procedure TWin32WSCustomImageListResolution.AddData(AListHandle: TLCLIntfH
DC: HDC;
DataCount, DataSize: Integer;
begin
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.bmiHeader.biSize := SizeOf(Info.bmiHeader);
Info.bmiHeader.biWidth := AWidth;
Info.bmiHeader.biHeight := -AHeight; // request top down
@ -157,7 +157,7 @@ class procedure TWin32WSCustomImageListResolution.AddData(AListHandle: TLCLIntfH
DC: HDC;
DataCount, DataSize, x, y, MaskStride: Integer;
begin
FillChar(Info, SizeOf(Info), 0);
FillChar(Info{%H-}, SizeOf(Info), 0);
Info.bmiHeader.biSize := SizeOf(Info.bmiHeader);
Info.bmiHeader.biWidth := AWidth;
Info.bmiHeader.biHeight := -AHeight; // request top down
@ -316,7 +316,7 @@ begin
if (ADrawEffect = gdeDisabled) and HasComCtl6 then
begin
// if it is manifested exe then use winXP algoriphm of gray painting
FillChar(DrawParams, SizeOf(DrawParams), 0);
FillChar(DrawParams{%H-}, SizeOf(DrawParams), 0);
DrawParams.cbSize := SizeOf(DrawParams);
DrawParams.himl := AList.Reference._Handle;
DrawParams.i := AIndex;

View File

@ -83,7 +83,7 @@ type
implementation
uses strutils;
//uses strutils;
type
TMenuItemHelper = class helper for TMenuItem

View File

@ -80,7 +80,7 @@ var
filename: WideString;
ico: TIcon;
begin
fileName := ATreeView.GetPathFromNode(ANode);
fileName := WideString(ATreeView.GetPathFromNode(ANode));
ico := GetShellIcon(fileName);
try
ATreeView.Canvas.Draw(ARect.Left, (ARect.Top + ARect.Bottom - ico.Height) div 2, ico);

View File

@ -120,7 +120,7 @@ function SpinUpDownWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
Result := (lWindowInfo<>nil) and (lWindowInfo^.AWinControl<>nil);
if Result then
begin
FillChar(LMessage, SizeOf(LMessage), 0);
FillChar(LMessage{%H-}, SizeOf(LMessage), 0);
LMessage.msg := Msg;
LMessage.wParam := WParam;
LMessage.lParam := LParam;

View File

@ -32,7 +32,7 @@ uses
StdCtrls, Controls, Graphics, Forms, Themes,
////////////////////////////////////////////////////
WSControls, WSStdCtrls, WSLCLClasses, WSProc, Windows, LCLIntf, LCLType,
LazUTF8, InterfaceBase, LMessages, LCLMessageGlue, TextStrings,
LazUTF8, LMessages, LCLMessageGlue, TextStrings,
Win32Int, Win32Proc, Win32WSControls, Win32Extra, Win32Themes;
type
@ -784,7 +784,7 @@ begin
begin
// Listbox has a border and Width argument is a window rect =>
// Decrease it by border width
Windows.GetClientRect(AWinControl.Handle, ARect);
Windows.GetClientRect(AWinControl.Handle, ARect{%H-});
DW := ARect.Right - ARect.Left;
Windows.GetWindowRect(AWinControl.Handle, ARect);
DW := ARect.Right - ARect.Left - DW;
@ -818,7 +818,7 @@ begin
begin
// if drag is called by mouse down then we need to complete it with mouse up
// since in other case we will not get the change event called
GetCursorPos(P);
GetCursorPos(P{%H-});
P := ACustomListBox.ScreenToClient(P);
CallDefaultWindowProc(ACustomListBox.Handle, WM_LBUTTONUP, 0, MAKELPARAM(P.X, P.Y));
end;
@ -1591,7 +1591,7 @@ var
begin
if Length(AText) > 0 then
begin
GetText(ACustomMemo, S);
GetText(ACustomMemo, S{%H-});
S := S + AText;
SetText(ACustomMemo, S);
end;