mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 02:58:05 +02:00
Merge branch 'win32-hints' into 'main'
fix many compiler hints, see https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39445 See merge request freepascal.org/lazarus/lazarus!33
This commit is contained in:
commit
aa74cc8211
@ -318,8 +318,6 @@ end;
|
||||
// The original function was about 2400 lines.
|
||||
|
||||
type
|
||||
TAccessCustomEdit = class(TCustomEdit);
|
||||
|
||||
{ TWindowProcHelper }
|
||||
|
||||
TWindowProcHelper = record
|
||||
@ -598,7 +596,8 @@ var
|
||||
{$endif}
|
||||
ParentPaintWindow: HWND;
|
||||
DCIndex: integer;
|
||||
parLeft, parTop: integer;
|
||||
parLeft: integer = 0;
|
||||
parTop: integer = 0;
|
||||
BufferWasSaved: Boolean;
|
||||
useDoubleBuffer: Boolean;
|
||||
isNativeControl: Boolean;
|
||||
@ -1121,12 +1120,12 @@ end;
|
||||
|
||||
procedure TWindowProcHelper.HandleDropFiles;
|
||||
var
|
||||
Files: Array of String;
|
||||
Files: Array of String = nil;
|
||||
Drop: HDROP;
|
||||
L: LongWord;
|
||||
I, C: Integer;
|
||||
DropForm: TWinControl;
|
||||
WideBuffer: WideString;
|
||||
WideBuffer: WideString = '';
|
||||
begin
|
||||
Drop := HDROP(WParam);
|
||||
try
|
||||
@ -1887,7 +1886,8 @@ end;
|
||||
|
||||
function TWindowProcHelper.DoMsgMove: Boolean;
|
||||
var
|
||||
NewLeft, NewTop: integer;
|
||||
NewLeft: integer = 0;
|
||||
NewTop: integer = 0;
|
||||
WindowPlacement: TWINDOWPLACEMENT;
|
||||
R: TRect;
|
||||
begin
|
||||
@ -1928,7 +1928,8 @@ end;
|
||||
|
||||
procedure TWindowProcHelper.DoMsgSize;
|
||||
var
|
||||
NewWidth, NewHeight: integer;
|
||||
NewWidth: integer = 0;
|
||||
NewHeight: integer = 0;
|
||||
OverlayWindow: HWND;
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
R: TRect;
|
||||
@ -2038,7 +2039,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 +2763,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;
|
||||
@ -2805,7 +2806,7 @@ var
|
||||
Owner: TWinControl;
|
||||
Control: TControl;
|
||||
P: TPoint;
|
||||
LRect: Windows.RECT;
|
||||
LRect: Windows.RECT = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
begin
|
||||
case Msg of
|
||||
WM_ERASEBKGND:
|
||||
|
@ -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
|
||||
@ -433,7 +433,10 @@ var
|
||||
Colors: array[0..3] of Cardinal; // reserve extra color for colormasks
|
||||
end;
|
||||
|
||||
SrcBytesPtr, DstBytesPtr, TmpBytesPtr, AlphaBytesPtr: Pointer;
|
||||
SrcBytesPtr: Pointer = nil;
|
||||
DstBytesPtr: Pointer = nil;
|
||||
AlphaBytesPtr: Pointer = nil;
|
||||
TmpBytesPtr: Pointer = nil;
|
||||
SrcLinePtr, DstLinePtr: PByte;
|
||||
CleanupSrc, CleanupSrcPtr, CleanupDst, CleanupAlpha: Boolean;
|
||||
SrcSize: PtrUInt;
|
||||
@ -515,7 +518,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
|
||||
|
@ -149,7 +149,7 @@ end;
|
||||
procedure TWin32WidgetSet.HandleProcessEvent(AData: PtrInt; AFlags: dword);
|
||||
var
|
||||
lProcessEvent: PProcessEvent absolute AData;
|
||||
exitcode: dword;
|
||||
exitcode: DWORD = 0;
|
||||
begin
|
||||
if not Windows.GetExitCodeProcess(lProcessEvent^.Handle, exitcode) then
|
||||
exitcode := 0;
|
||||
@ -259,6 +259,7 @@ var
|
||||
begin
|
||||
WndClassName := 'LazRubberBand' + IntToStr(ABrush);
|
||||
|
||||
FillChar(WindowClass{%H-}, SizeOf(WindowClass), 0);
|
||||
if not Windows.GetClassInfo(System.HInstance, PChar(WndClassName), WindowClass) then
|
||||
begin
|
||||
with WindowClass do
|
||||
@ -701,7 +702,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
|
||||
@ -795,7 +796,8 @@ var
|
||||
Header: Windows.TBitmapInfoHeader;
|
||||
Colors: array[0..1] of Cardinal; // reserve extra color for mono bitmaps
|
||||
end;
|
||||
DstLinePtr, SrcLinePtr: PByte;
|
||||
SrcLinePtr: PByte = nil;
|
||||
DstLinePtr: PByte = nil;
|
||||
SrcPixelPtr, DstPixelPtr: PByte;
|
||||
DstLineSize, SrcLineSize: PtrUInt;
|
||||
x, y: Integer;
|
||||
@ -815,7 +817,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
|
||||
@ -1010,7 +1012,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);
|
||||
@ -1075,7 +1077,7 @@ var
|
||||
Colors: array[0..1] of Cardinal; // reserve extra color for mono bitmaps
|
||||
end;
|
||||
|
||||
BitsPtr: Pointer;
|
||||
BitsPtr: Pointer = nil;
|
||||
|
||||
copyDC, fillDC: HDC;
|
||||
bmp, copyOld, fillOld, copyBmp, fillBmp: HBITMAP;
|
||||
@ -1100,7 +1102,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;
|
||||
|
@ -147,7 +147,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32ListStringList.Get(Index: Integer): String;
|
||||
Var
|
||||
w: widestring;
|
||||
w: widestring = '';
|
||||
begin
|
||||
if (Index < 0) Or (Index >= Count) then
|
||||
raise Exception.Create('Out of bounds.')
|
||||
@ -321,7 +321,7 @@ end;
|
||||
|
||||
procedure TWin32ComboBoxStringList.Assign(Source: TPersistent);
|
||||
var
|
||||
EditText: string;
|
||||
EditText: string = '';
|
||||
lItemIndex: integer;
|
||||
begin
|
||||
if Source is TStrings then
|
||||
|
@ -64,7 +64,7 @@ end;
|
||||
function TWin32MemoStrings.Get(Index: Integer): string;
|
||||
var
|
||||
len: Integer;
|
||||
WideBuffer: WideString;
|
||||
WideBuffer: WideString = '';
|
||||
begin
|
||||
len := GetLineLength(Index);
|
||||
if len=0 then
|
||||
@ -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;
|
||||
|
@ -400,6 +400,7 @@ begin
|
||||
end else
|
||||
if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
|
||||
begin
|
||||
FillChar(AMessage{%H-}, SizeOf(AMessage), 0);
|
||||
while PeekMessage(AMessage, HWnd(nil), 0, 0, PM_REMOVE) do
|
||||
begin
|
||||
if AMessage.message = WM_QUIT then
|
||||
@ -654,6 +655,7 @@ procedure TWin32WidgetSet.UpdateMDIClientBounds;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
Windows.GetClientRect(Application.MainFormHandle, Result);
|
||||
for I := 0 to Application.MainForm.ControlCount - 1 do
|
||||
if Application.MainForm.Controls[I].Visible then
|
||||
|
@ -555,7 +555,7 @@ end;
|
||||
class procedure TWin32WSCustomTabControl.AdjustSizeTabControlPages(const ATabControl: TCustomTabControl);
|
||||
var
|
||||
I: Integer;
|
||||
R: TRect;
|
||||
R: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
WinHandle: HWND;
|
||||
lPage: TCustomPage;
|
||||
begin
|
||||
@ -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.
|
||||
|
@ -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,6 +723,7 @@ begin
|
||||
// add the upper frame with the caption
|
||||
DC := Windows.GetDC(Handle);
|
||||
SelectObject(DC, TheWinControl.Font.Reference.Handle);
|
||||
FillChar(TM{%H-}, SizeOf(TM), 0);
|
||||
Windows.GetTextMetrics(DC, TM);
|
||||
ORect.Top := TM.TMHeight + 3;
|
||||
Windows.ReleaseDC(Handle, DC);
|
||||
@ -776,7 +777,8 @@ end;
|
||||
|
||||
procedure GetWin32ControlPos(Window, Parent: HWND; var Left, Top: integer);
|
||||
var
|
||||
parRect, winRect: Windows.TRect;
|
||||
parRect: Windows.TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
winRect: Windows.TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
begin
|
||||
Windows.GetWindowRect(Window, winRect);
|
||||
Windows.GetWindowRect(Parent, parRect);
|
||||
@ -1039,7 +1041,7 @@ end;
|
||||
function MeasureTextForWnd(const AWindow: HWND; Text: string; var Width,
|
||||
Height: integer): boolean;
|
||||
var
|
||||
textSize: Windows.SIZE;
|
||||
textSize: Windows.SIZE = (cx: 0; cy: 0);
|
||||
canvasHandle: HDC;
|
||||
oldFontHandle, newFontHandle: HFONT;
|
||||
begin
|
||||
@ -1067,7 +1069,7 @@ end;
|
||||
function GetControlText(AHandle: HWND): string;
|
||||
var
|
||||
TextLen: longint;
|
||||
WideBuffer: WideString;
|
||||
WideBuffer: WideString = '';
|
||||
begin
|
||||
TextLen := Windows.GetWindowTextLengthW(AHandle);
|
||||
SetLength(WideBuffer, TextLen);
|
||||
@ -1193,7 +1195,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 +1328,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;
|
||||
|
@ -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
|
||||
@ -221,7 +221,7 @@ begin
|
||||
end;
|
||||
idButtonShield:
|
||||
begin
|
||||
FillChar(SHIconInfo, SizeOf(SHIconInfo), 0);
|
||||
FillChar(SHIconInfo{%H-}, SizeOf(SHIconInfo), 0);
|
||||
SHIconInfo.cbSize := SizeOf(SHIconInfo);
|
||||
if (SHGetStockIconInfo(SIID_SHIELD, SHGFI_ICON or SHGFI_SMALLICON, @SHIconInfo) = S_OK) then
|
||||
IconHandle := SHIconInfo.hIcon
|
||||
@ -290,6 +290,7 @@ begin
|
||||
with Details do
|
||||
begin
|
||||
w := UTF8ToUTF16(S);
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
GetThemeTextExtent(Theme[Element], DC, Part, State, PWideChar(W), Length(W),
|
||||
Flags, BoundingRect, Result);
|
||||
end
|
||||
@ -432,6 +433,7 @@ begin
|
||||
ExStyle := GetWindowLong(Handle, GWL_EXSTYLE);
|
||||
if (ExStyle and WS_EX_CLIENTEDGE) <> 0 then
|
||||
begin
|
||||
DrawRect := Rect(0, 0, 0, 0);
|
||||
GetWindowRect(Handle, DrawRect);
|
||||
OffsetRect(DrawRect, -DrawRect.Left, -DrawRect.Top);
|
||||
DC := GetWindowDC(Handle);
|
||||
|
@ -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;
|
||||
|
@ -49,7 +49,11 @@
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.Arc(DC: HDC; Left, Top, Right, Bottom, Angle16Deg, Angle16DegLength: Integer): Boolean;
|
||||
var
|
||||
SX, SY, EX, EY, OldArcDirection: Longint;
|
||||
SX: LongInt = 0;
|
||||
SY: LongInt = 0;
|
||||
EX: LongInt = 0;
|
||||
EY: LongInt = 0;
|
||||
OldArcDirection: Longint;
|
||||
begin
|
||||
if Angle16DegLength < 0 then OldArcDirection := Windows.SetArcDirection(DC, AD_CLOCKWISE)
|
||||
else OldArcDirection := Windows.SetArcDirection(DC, AD_COUNTERCLOCKWISE);
|
||||
@ -77,7 +81,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 +185,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
|
||||
@ -372,8 +376,8 @@ var
|
||||
{$ENDIF}
|
||||
Bitmap: TBitmap;
|
||||
BufferStream: TMemoryStream;
|
||||
BufferWideString: widestring;
|
||||
BufferString: ansistring;
|
||||
BufferWideString: widestring = '';
|
||||
BufferString: ansistring = '';
|
||||
|
||||
function ReadClipboardToStream(DestStream: TStream): Boolean;
|
||||
begin
|
||||
@ -560,8 +564,8 @@ function TWin32WidgetSet.ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
||||
var
|
||||
DataStream, BufferStream: TStream;
|
||||
Bitmap: TBitmap;
|
||||
BufferWideString: widestring;
|
||||
BufferString: ansistring;
|
||||
BufferWideString: widestring = '';
|
||||
BufferString: ansistring = '';
|
||||
ScreenDC, MemDC: HDC;
|
||||
OldBitmap, NewBitmap, Mask: HBitmap;
|
||||
begin
|
||||
@ -1340,6 +1344,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);
|
||||
@ -1512,7 +1517,7 @@ function TWin32WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: LongInt;
|
||||
var
|
||||
s: AnsiString;
|
||||
w: WideString;
|
||||
DxWide: _TIntArray;
|
||||
DxWide: _TIntArray = nil;
|
||||
nIndex: Integer;
|
||||
begin
|
||||
// use temp buffer, if count is set, there might be no null terminator
|
||||
@ -1856,6 +1861,8 @@ 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;
|
||||
DCOrg.X := 0;
|
||||
DCOrg.Y := 0;
|
||||
Result := Windows.GetDCOrgEx(PaintDC, DCOrg);
|
||||
if not Result then Exit;
|
||||
winOrg.X := 0;
|
||||
@ -1898,6 +1905,7 @@ begin
|
||||
hWindow := WindowFromDC(DC);
|
||||
if hWindow <> HWND(nil) then
|
||||
begin
|
||||
ClientRect := Rect(0, 0, 0, 0);
|
||||
Result := GetClientRect(hWindow, ClientRect);
|
||||
P.x := ClientRect.Right;
|
||||
P.y := ClientRect.Bottom;
|
||||
@ -2432,7 +2440,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 +3687,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;
|
||||
|
@ -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
|
||||
@ -123,7 +126,7 @@ var
|
||||
BitBtnDC: HDC; // Handle to DC of bitbtn window
|
||||
OldFontHandle: HFONT; // Handle of previous font in hdcNewBitmap
|
||||
hdcNewBitmap: HDC; // Device context of the new Bitmap
|
||||
TextSize: Windows.SIZE; // For computing the length of button caption in pixels
|
||||
TextSize: Windows.SIZE = (cx: 0; cy: 0); // For computing the length of button caption in pixels
|
||||
OldBitmap: HBITMAP; // Handle to the old selected bitmap
|
||||
NewBitmap: HBITMAP; // Handle of the new bitmap
|
||||
XDestBitmap, YDestBitmap: integer; // X,Y coordinate of destination rectangle for bitmap
|
||||
@ -154,7 +157,7 @@ var
|
||||
glyphWidth, glyphHeight: integer;
|
||||
OldBitmapHandle: HBITMAP; // Handle of the provious bitmap in hdcNewBitmap
|
||||
OldTextAlign: Integer;
|
||||
TmpDC: HDC;
|
||||
TmpDC: HDC = 0;
|
||||
PaintBuffer: HPAINTBUFFER;
|
||||
Options: DTTOpts;
|
||||
Details: TThemedElementDetails;
|
||||
@ -173,7 +176,7 @@ 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;
|
||||
PaintBuffer := BeginBufferedPaint(hdcNewBitmap, @BitmapRect, BPBF_COMPOSITED, @PaintParams, TmpDC);
|
||||
@ -202,7 +205,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 +223,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 +264,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 +303,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;
|
||||
@ -590,7 +593,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
|
||||
|
@ -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,6 +160,7 @@ begin
|
||||
{$ifdef debug_win32calendar}
|
||||
if IsConsole then writeln(' HitTestInfo.cbSize = ',HitTestInfo.cbSize);
|
||||
{$endif}
|
||||
FillChar(HitTestInfo{%H-}, SizeOf(HitTestInfo), 0);
|
||||
HitPart := SendMessage(ACalendar.Handle, MCM_HITTEST, 0, LPARAM(@HitTestInfo));
|
||||
{$ifdef debug_win32calendar}
|
||||
//if IsConsole then writeln('TWin32WSCustomCalendar.HitTest: Handle = ',IntToHex(ACalendar.Handle,8));
|
||||
@ -232,7 +233,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);
|
||||
|
@ -299,7 +299,7 @@ var
|
||||
Flags: LongWord;
|
||||
Parent: HWND;
|
||||
PreferredSizeStatusBar: HWND;
|
||||
R: TRect;
|
||||
R: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
AErrorCode: Cardinal;
|
||||
begin
|
||||
Flags := WS_CHILD or WS_CLIPSIBLINGS or WS_CLIPCHILDREN;
|
||||
|
@ -261,7 +261,7 @@ end;
|
||||
|
||||
class procedure TWin32WSCustomListView.ColumnDoAutosize(const ALV: TCustomListView; const AIndex: Integer);
|
||||
var
|
||||
CaptionSize: TSize;
|
||||
CaptionSize: TSize = (cx: 0; cy: 0);
|
||||
begin
|
||||
if (ALV.Items.Count > 0) then
|
||||
ListView_SetColumnWidth(ALV.Handle, AIndex, LVSCW_AUTOSIZE)
|
||||
@ -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
|
||||
@ -1120,7 +1120,7 @@ class procedure TWin32WSCustomListView.PositionHeader(const AHandle: THandle);
|
||||
var
|
||||
hwndHeader: HWND;
|
||||
dwStyle: PtrInt;
|
||||
rc: TRect;
|
||||
rc: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
hdLayout: THDLAYOUT;
|
||||
wpos: Windows.TWINDOWPOS;
|
||||
begin
|
||||
@ -1133,7 +1133,7 @@ begin
|
||||
if hwndHeader = 0 then Exit; // nothing to do
|
||||
|
||||
Windows.GetClientRect(AHandle, rc);
|
||||
FillChar(hdLayout, SizeOf(hdLayout), 0);
|
||||
FillChar(hdLayout{%H-}, SizeOf(hdLayout), 0);
|
||||
hdLayout.prc := @rc;
|
||||
hdLayout.pwpos := @wpos;
|
||||
Header_Layout(hwndHeader, hdLayout);
|
||||
@ -1392,7 +1392,7 @@ end;
|
||||
class procedure TWin32WSCustomListView.SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint);
|
||||
var
|
||||
dx, dy: Integer;
|
||||
Origin: TPoint;
|
||||
Origin: TPoint = (X: 0; Y: 0);
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'SetViewOrigin')
|
||||
then Exit;
|
||||
|
@ -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;
|
||||
@ -866,16 +866,17 @@ end;
|
||||
|
||||
class function TWin32WSOpenDialog.ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
||||
var
|
||||
ShellItems: IShellItemArray;
|
||||
ShellItem: IShellItem;
|
||||
I, Count: DWord;
|
||||
ShellItems: IShellItemArray = nil;
|
||||
ShellItem: IShellItem = nil;
|
||||
I: DWORD;
|
||||
Count: DWORD = 0;
|
||||
begin
|
||||
// TODO: ofExtensionDifferent, ofReadOnly
|
||||
if not Supports(ADialog, IFileOpenDialog) then
|
||||
Result := E_FAIL
|
||||
else
|
||||
Result := (ADialog as IFileOpenDialog).GetResults(ShellItems{%H-});
|
||||
if Succeeded(Result) and Succeeded(ShellItems.GetCount(Count{%H-})) then
|
||||
Result := (ADialog as IFileOpenDialog).GetResults(ShellItems);
|
||||
if Succeeded(Result) and Succeeded(ShellItems.GetCount(Count)) then
|
||||
begin
|
||||
AOpenDialog.Files.Clear;
|
||||
I := 0;
|
||||
@ -1128,7 +1129,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
|
||||
|
@ -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 }
|
||||
|
@ -99,7 +99,8 @@ var
|
||||
DialogRec: POpenFileDialogRec;
|
||||
AControl: TPreviewFileControl;
|
||||
stc32Handle: Handle;
|
||||
ARect, ADialogRect: TRect;
|
||||
ARect: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
ADialogRect: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
begin
|
||||
Result := OpenFileDialogCallBack(hWnd, uMsg, wParam, lparam);
|
||||
if uMsg = WM_INITDIALOG then
|
||||
|
@ -626,7 +626,8 @@ class procedure TWin32WSCustomForm.SetBounds(const AWinControl: TWinControl;
|
||||
const ALeft, ATop, AWidth, AHeight: Integer);
|
||||
var
|
||||
AForm: TCustomForm absolute AWinControl;
|
||||
CurRect, SizeRect: Windows.RECT;
|
||||
CurRect: Windows.RECT = (Left: 0; Top: 0; Right: 0; Bottom: 0);
|
||||
SizeRect: Windows.RECT;
|
||||
L, T, W, H: Integer;
|
||||
begin
|
||||
// the LCL defines the size of a form without border, win32 with.
|
||||
|
@ -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;
|
||||
|
@ -83,7 +83,7 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses strutils;
|
||||
//uses strutils;
|
||||
|
||||
type
|
||||
TMenuItemHelper = class helper for TMenuItem
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user