瀏覽代碼

Should be finished now unless there's still files in .\Projects used but not listed in any of the projects.

Martijn Laan 1 年之前
父節點
當前提交
82e5800758

+ 1 - 1
Components/ASMInline.pas

@@ -23,7 +23,7 @@ interface
   !!!! Not all special cases have been implemented in WriteRegRef().
   !!!! Not all special cases have been implemented in WriteRegRef().
 }
 }
 
 
-uses Sysutils, windows, classes, contnrs;
+uses Sysutils, Windows, Classes, Contnrs;
 
 
 type
 type
   TModMode = (mmNaked, mmDeref, mmDisp8, mmDisp32);
   TModMode = (mmNaked, mmDeref, mmDisp8, mmDisp32);

+ 8 - 77
Components/FolderTreeView.pas

@@ -2,7 +2,7 @@ unit FolderTreeView;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2018 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -24,7 +24,6 @@ type
   private
   private
     FDestroyingHandle: Boolean;
     FDestroyingHandle: Boolean;
     FDirectory: String;
     FDirectory: String;
-    FFriendlyTree: Boolean;
     FItemExpanding: Boolean;
     FItemExpanding: Boolean;
     FOnChange: TNotifyEvent;
     FOnChange: TNotifyEvent;
     FOnRename: TFolderRenameEvent;
     FOnRename: TFolderRenameEvent;
@@ -329,34 +328,6 @@ begin
   end;
   end;
 end;
 end;
 
 
-function UseFriendlyTree: Boolean;
-{ Returns True if running Windows XP or 2003 and the "Display simple folder
-  view" option in Explorer is enabled (by default, it is).
-  Note: Windows Vista also has this option, but regardless of how it is set,
-  folders never expand with a single click in Explorer. So on Vista and later,
-  False is always returned. }
-var
-  Ver: Word;
-  K: HKEY;
-  Typ, Value, Size: DWORD;
-begin
-  Ver := Word(GetVersion);
-  if (Lo(Ver) = 5) and (Hi(Ver) >= 1) then begin
-    Result := True;
-    if RegOpenKeyEx(HKEY_CURRENT_USER,
-       'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced',
-       0, KEY_QUERY_VALUE, K) = ERROR_SUCCESS then begin
-      Size := SizeOf(Value);
-      if (RegQueryValueEx(K, 'FriendlyTree', nil, @Typ, @Value, @Size) = ERROR_SUCCESS) and
-         (Typ = REG_DWORD) and (Size = SizeOf(Value)) then
-        Result := (Value <> 0);
-      RegCloseKey(K);
-    end;
-  end
-  else
-    Result := False;
-end;
-
 { TCustomFolderTreeView }
 { TCustomFolderTreeView }
 
 
 type
 type
@@ -377,8 +348,6 @@ begin
   Height := 97;
   Height := 97;
   ParentColor := False;
   ParentColor := False;
   TabStop := True;
   TabStop := True;
-  if Lo(GetVersion) < 6 then
-    Cursor := crArrow;  { prevent hand cursor from appearing in TVS_TRACKSELECT mode }
   if SystemParametersInfo(SPI_GETICONTITLELOGFONT, SizeOf(LogFont), @LogFont, 0) then
   if SystemParametersInfo(SPI_GETICONTITLELOGFONT, SizeOf(LogFont), @LogFont, 0) then
     Font.Handle := CreateFontIndirect(LogFont);
     Font.Handle := CreateFontIndirect(LogFont);
 end;
 end;
@@ -394,15 +363,7 @@ begin
   with Params do begin
   with Params do begin
     Style := Style or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or TVS_LINESATROOT or
     Style := Style or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or TVS_LINESATROOT or
       TVS_HASBUTTONS or TVS_SHOWSELALWAYS or TVS_EDITLABELS;
       TVS_HASBUTTONS or TVS_SHOWSELALWAYS or TVS_EDITLABELS;
-    FFriendlyTree := UseFriendlyTree;
-    if FFriendlyTree then
-      Style := Style or TVS_TRACKSELECT or TVS_SINGLEEXPAND
-    else begin
-      if Lo(GetVersion) >= 6 then
-        Style := Style or TVS_TRACKSELECT
-      else
-        Style := Style or TVS_HASLINES;
-    end;
+    Style := Style or TVS_TRACKSELECT;
     ExStyle := ExStyle or WS_EX_CLIENTEDGE;
     ExStyle := ExStyle or WS_EX_CLIENTEDGE;
     WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
     WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
   end;
   end;
@@ -420,8 +381,8 @@ begin
   if csDesigning in ComponentState then
   if csDesigning in ComponentState then
     Exit;
     Exit;
 
 
-  { On Vista, enable the new Explorer-style look }
-  if (Lo(GetVersion) >= 6) and Assigned(SetWindowTheme) then begin
+  { Enable the new Explorer-style look }
+  if Assigned(SetWindowTheme) then begin
     SetWindowTheme(Handle, 'Explorer', nil);
     SetWindowTheme(Handle, 'Explorer', nil);
     { Like Explorer, enable double buffering to avoid flicker when the mouse
     { Like Explorer, enable double buffering to avoid flicker when the mouse
       is moved across the items }
       is moved across the items }
@@ -489,7 +450,7 @@ end;
 
 
 procedure TCustomFolderTreeView.WMEraseBkgnd(var Message: TWMEraseBkgnd);
 procedure TCustomFolderTreeView.WMEraseBkgnd(var Message: TWMEraseBkgnd);
 begin
 begin
-  { For TVS_EX_DOUBLEBUFFER to be truly flicker-free on Vista, we must use
+  { For TVS_EX_DOUBLEBUFFER to be truly flicker-free, we must use
     comctl32's default WM_ERASEBKGND handling, not the VCL's (which calls
     comctl32's default WM_ERASEBKGND handling, not the VCL's (which calls
     FillRect). }
     FillRect). }
   DefaultHandler(Message);
   DefaultHandler(Message);
@@ -555,19 +516,8 @@ const
     if Assigned(Item) then begin
     if Assigned(Item) then begin
       if HitTestInfo.flags and TVHT_ONITEMBUTTON <> 0 then
       if HitTestInfo.flags and TVHT_ONITEMBUTTON <> 0 then
         TreeView_Expand(Handle, Item, TVE_TOGGLE)
         TreeView_Expand(Handle, Item, TVE_TOGGLE)
-      else begin
-        if TreeView_GetSelection(Handle) <> Item then
-          SelectItem(Item)
-        else begin
-          { In 'friendly tree' mode, if the item is already selected, ensure
-            it's expanded.
-            Note: We do this only if SelectItem wasn't called, since newly
-            selected items are expanded automatically. If we were to call this
-            unconditionally, any error message would be shown twice. }
-          if FFriendlyTree and (HitTestInfo.flags and TVHT_ONITEM <> 0) then
-            TreeView_Expand(Handle, Item, TVE_EXPAND);
-        end;
-      end;
+      else if TreeView_GetSelection(Handle) <> Item then
+        SelectItem(Item);
     end;
     end;
   end;
   end;
 
 
@@ -687,25 +637,6 @@ begin
         HandleClick;
         HandleClick;
         Message.Result := 1;
         Message.Result := 1;
       end;
       end;
-    TVN_SINGLEEXPAND:
-      begin
-        Hdr := PNMTreeView(Message.NMHdr);
-        { Trying to emulate Windows XP's Explorer here:
-          Only collapse old item if it's at the same level as the new item. }
-        if Assigned(Hdr.itemOld.hItem) and Assigned(Hdr.itemNew.hItem) and
-           (TreeView_GetParent(Handle, Hdr.itemNew.hItem) <>
-            TreeView_GetParent(Handle, Hdr.itemOld.hItem)) then
-          Message.Result := Message.Result or TVNRET_SKIPOLD;
-        { Selecting expanded items shouldn't collapse them }
-        if Assigned(Hdr.itemNew.hItem) then begin
-          TVItem.mask := TVIF_STATE;
-          TVItem.hItem := Hdr.itemNew.hItem;
-          TVItem.stateMask := TVIS_EXPANDED;
-          if TreeView_GetItem(Handle, TVItem) and
-             (TVItem.state and TVIS_EXPANDED <> 0) then
-            Message.Result := Message.Result or TVNRET_SKIPNEW;
-        end;
-      end;
   end;
   end;
 end;
 end;
 
 
@@ -1205,5 +1136,5 @@ end;
 initialization
 initialization
   InitThemeLibrary;
   InitThemeLibrary;
   SHPathPrepareForWriteFunc := GetProcAddress(LoadLibrary(PChar(AddBackslash(GetSystemDir) + shell32)),
   SHPathPrepareForWriteFunc := GetProcAddress(LoadLibrary(PChar(AddBackslash(GetSystemDir) + shell32)),
-    {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
+    'SHPathPrepareForWriteW');
 end.
 end.

+ 4 - 57
Components/NewCheckListBox.pas

@@ -93,10 +93,9 @@ type
     procedure LBDeleteString(var Message: TMessage); message LB_DELETESTRING;
     procedure LBDeleteString(var Message: TMessage); message LB_DELETESTRING;
     procedure LBResetContent(var Message: TMessage); message LB_RESETCONTENT;
     procedure LBResetContent(var Message: TMessage); message LB_RESETCONTENT;
     procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
     procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
-    procedure WMGetObject(var Message: TMessage); message $003D; //WM_GETOBJECT
+    procedure WMGetObject(var Message: TMessage); message WM_GETOBJECT;
     procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
     procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
     procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
     procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
-    procedure WMMouseWheel(var Message: TMessage); message $020A; //WM_MOUSEWHEEL
     procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
     procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
     procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
     procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
     procedure WMSize(var Message: TWMSize); message WM_SIZE;
     procedure WMSize(var Message: TWMSize); message WM_SIZE;
@@ -239,9 +238,6 @@ const
   IID_IAccessible: TGUID = (
   IID_IAccessible: TGUID = (
     D1:$618736e0; D2:$3c3d; D3:$11cf; D4:($81,$0c,$00,$aa,$00,$38,$9b,$71));
     D1:$618736e0; D2:$3c3d; D3:$11cf; D4:($81,$0c,$00,$aa,$00,$38,$9b,$71));
 
 
-var
-  CanQueryUIState: Boolean;
-
 type
 type
   TWinControlAccess = class (TWinControl);
   TWinControlAccess = class (TWinControl);
 
 
@@ -623,8 +619,8 @@ begin
       FlipRect(rcItem, ClientRect, FUseRightToLeft);
       FlipRect(rcItem, ClientRect, FUseRightToLeft);
     end;
     end;
     { Don't let TCustomListBox.CNDrawItem draw the focus }
     { Don't let TCustomListBox.CNDrawItem draw the focus }
-    if FWantTabs or (CanQueryUIState and
-      (SendMessage(Handle, WM_QUERYUISTATE, 0, 0) and UISF_HIDEFOCUS <> 0)) then
+    if FWantTabs or
+      (SendMessage(Handle, WM_QUERYUISTATE, 0, 0) and UISF_HIDEFOCUS <> 0) then
       itemState := itemState and not ODS_FOCUS;
       itemState := itemState and not ODS_FOCUS;
     inherited;
     inherited;
   end;
   end;
@@ -775,10 +771,7 @@ begin
   FlipRect(Rect, SavedClientRect, FUseRightToLeft);
   FlipRect(Rect, SavedClientRect, FUseRightToLeft);
 
 
   ItemState := ItemStates[Index];
   ItemState := ItemStates[Index];
-  if CanQueryUIState then
-    UIState := SendMessage(Handle, WM_QUERYUISTATE, 0, 0)
-  else
-    UIState := 0; //no UISF_HIDEACCEL and no UISF_HIDEFOCUS
+  UIState := SendMessage(Handle, WM_QUERYUISTATE, 0, 0);
   Disabled := not Enabled or not ItemState.Enabled;
   Disabled := not Enabled or not ItemState.Enabled;
   with Canvas do begin
   with Canvas do begin
     if not FWantTabs and (odSelected in State) and Focused then begin
     if not FWantTabs and (odSelected in State) and Focused then begin
@@ -1751,39 +1744,6 @@ begin
   UpdateHotIndex(NewHotIndex);
   UpdateHotIndex(NewHotIndex);
 end;
 end;
 
 
-procedure TNewCheckListBox.WMMouseWheel(var Message: TMessage);
-const
-  WHEEL_DELTA = 120;
-begin
-  { Work around a Windows bug (reproducible on 2000/XP/2003, but not Vista):
-    On an ownerdraw-variable list box, scrolling up or down more than one item
-    at a time with animation enabled causes a strange effect: first all visible
-    items appear to scroll off the bottom, then the items are all repainted in
-    the correct position. To avoid that, we implement our own mouse wheel
-    handling that scrolls only one item at a time.
-    (Note: The same problem exists when scrolling a page at a time using the
-    scroll bar. But because it's not as obvious, we don't work around it.) }
-  if (Lo(GetVersion) = 5) and
-     (Message.WParam and (MK_CONTROL or MK_SHIFT) = 0) then begin
-    Inc(FWheelAccum, Smallint(Message.WParam shr 16));
-    if Abs(FWheelAccum) >= WHEEL_DELTA then begin
-      while FWheelAccum >= WHEEL_DELTA do begin
-        SendMessage(Handle, WM_VSCROLL, SB_LINEUP, 0);
-        Dec(FWheelAccum, WHEEL_DELTA);
-      end;
-      while FWheelAccum <= -WHEEL_DELTA do begin
-        SendMessage(Handle, WM_VSCROLL, SB_LINEDOWN, 0);
-        Inc(FWheelAccum, WHEEL_DELTA);
-      end;
-      SendMessage(Handle, WM_VSCROLL, SB_ENDSCROLL, 0);
-    end;
-  end
-  else
-    { Like the default handling, don't scroll if Control or Shift are down,
-      and on Vista always use the default handling since it isn't bugged. }
-    inherited;
-end;
-
 procedure TNewCheckListBox.WMNCHitTest(var Message: TWMNCHitTest);
 procedure TNewCheckListBox.WMNCHitTest(var Message: TWMNCHitTest);
 var
 var
   I: Integer;
   I: Integer;
@@ -2144,18 +2104,6 @@ begin
   RegisterComponents('JR', [TNewCheckListBox]);
   RegisterComponents('JR', [TNewCheckListBox]);
 end;
 end;
 
 
-procedure InitCanQueryUIState;
-var
-  OSVersionInfo: TOSVersionInfo;
-begin
-  CanQueryUIState := False;
-  if Win32Platform = VER_PLATFORM_WIN32_NT then begin
-    OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
-    if GetVersionEx(OSVersionInfo) then
-      CanQueryUIState := OSVersionInfo.dwMajorVersion >= 5;
-  end;
-end;
-
 { Note: This COM initialization code based on code from DBTables }
 { Note: This COM initialization code based on code from DBTables }
 var
 var
   SaveInitProc: Pointer;
   SaveInitProc: Pointer;
@@ -2172,7 +2120,6 @@ initialization
     SaveInitProc := InitProc;
     SaveInitProc := InitProc;
     InitProc := @InitCOM;
     InitProc := @InitCOM;
   end;
   end;
-  InitCanQueryUIState;
   InitThemeLibrary;
   InitThemeLibrary;
   NotifyWinEventFunc := GetProcAddress(GetModuleHandle(user32), 'NotifyWinEvent');
   NotifyWinEventFunc := GetProcAddress(GetModuleHandle(user32), 'NotifyWinEvent');
 finalization
 finalization

+ 8 - 23
Components/NewProgressBar.pas

@@ -2,13 +2,13 @@ unit NewProgressBar;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2018 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
   TNewProgressBar component - a smooth 32 bit TProgressBar
   TNewProgressBar component - a smooth 32 bit TProgressBar
 
 
-  Note: themed Vista and newer animate progress bars and don't immediately show changes.
+  Note: themed animated progress bars and don't immediately show changes.
   This applies both to Position and State. For example if you set State while the
   This applies both to Position and State. For example if you set State while the
   progress bar is still moving towards a new Position, the new State doesnt show until
   progress bar is still moving towards a new Position, the new State doesnt show until
   the moving animation has finished.
   the moving animation has finished.
@@ -59,9 +59,6 @@ implementation
 uses
 uses
   Windows, CommCtrl;
   Windows, CommCtrl;
 
 
-var
-  XP, Vista: Boolean;
-
 procedure Register;
 procedure Register;
 begin
 begin
   RegisterComponents('JR', [TNewProgressBar]);
   RegisterComponents('JR', [TNewProgressBar]);
@@ -85,7 +82,7 @@ begin
   inherited;
   inherited;
   CreateSubClass(Params, PROGRESS_CLASS);
   CreateSubClass(Params, PROGRESS_CLASS);
   Params.Style := Params.Style or PBS_SMOOTH;
   Params.Style := Params.Style or PBS_SMOOTH;
-  if XP and (Style = npbstMarquee) then
+  if Style = npbstMarquee then
     Params.Style := Params.Style or PBS_MARQUEE;
     Params.Style := Params.Style or PBS_MARQUEE;
 end;
 end;
 
 
@@ -97,8 +94,7 @@ begin
   SendMessage(Handle, PBM_SETRANGE, 0, MAKELPARAM(0, 65535));
   SendMessage(Handle, PBM_SETRANGE, 0, MAKELPARAM(0, 65535));
   SetPosition(FPosition);
   SetPosition(FPosition);
   SetState(FState);
   SetState(FState);
-  if XP then
-    SendMessage(Handle, PBM_SETMARQUEE, WPARAM(FStyle = npbstMarquee), 0);
+  SendMessage(Handle, PBM_SETMARQUEE, WPARAM(FStyle = npbstMarquee), 0);
 end;
 end;
 
 
 procedure TNewProgressBar.SetMin(Value: LongInt);
 procedure TNewProgressBar.SetMin(Value: LongInt);
@@ -132,16 +128,14 @@ const
   PBM_SETSTATE = WM_USER+16;
   PBM_SETSTATE = WM_USER+16;
   States: array[TNewProgressBarState] of UINT = (PBST_NORMAL, PBST_ERROR, PBST_PAUSED);
   States: array[TNewProgressBarState] of UINT = (PBST_NORMAL, PBST_ERROR, PBST_PAUSED);
 begin
 begin
-  if Vista then begin
-    FState := Value;
-    if HandleAllocated then
-      SendMessage(Handle, PBM_SETSTATE, States[Value], 0);
-  end;
+  FState := Value;
+  if HandleAllocated then
+    SendMessage(Handle, PBM_SETSTATE, States[Value], 0);
 end;
 end;
 
 
 procedure TNewProgressBar.SetStyle(Value: TNewProgressBarStyle);
 procedure TNewProgressBar.SetStyle(Value: TNewProgressBarStyle);
 begin
 begin
-  if XP and (FStyle <> Value) then begin
+  if FStyle <> Value then begin
     FStyle := Value;
     FStyle := Value;
     RecreateWnd;
     RecreateWnd;
   end;
   end;
@@ -158,13 +152,4 @@ begin
   DefaultHandler(Message);
   DefaultHandler(Message);
 end;
 end;
 
 
-var
-  OSVersionInfo: TOSVersionInfo;
-
-initialization
-  OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
-  if GetVersionEx(OSVersionInfo) then begin
-    Vista := OSVersionInfo.dwMajorVersion >= 6;
-    XP := Vista or ((OSVersionInfo.dwMajorVersion = 5) and (OSVersionInfo.dwMinorVersion >= 1));
-  end;
 end.
 end.

+ 3 - 53
Components/NewStaticText.pas

@@ -1,22 +1,12 @@
 unit NewStaticText;
 unit NewStaticText;
 
 
 {
 {
-  TNewStaticText - similar to TStaticText on D3+ but with multi-line AutoSize
+  TNewStaticText - similar to TStaticText but with multi-line AutoSize
   support and a WordWrap property
   support and a WordWrap property
 }
 }
 
 
 interface
 interface
 
 
-{$IFNDEF VER90}
-  {$IFNDEF VER100}
-    {$IFNDEF VER120}
-      {$IFNDEF VER130}
-        {$DEFINE Delphi6OrHigher}
-      {$ENDIF}
-    {$ENDIF}
-  {$ENDIF}
-{$ENDIF}
-
 uses
 uses
   Windows, Messages, SysUtils, Classes, Controls, Forms;
   Windows, Messages, SysUtils, Classes, Controls, Forms;
 
 
@@ -44,7 +34,7 @@ type
     procedure CreateParams(var Params: TCreateParams); override;
     procedure CreateParams(var Params: TCreateParams); override;
     procedure Loaded; override;
     procedure Loaded; override;
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
-    procedure SetAutoSize(Value: Boolean); {$IFDEF Delphi6OrHigher}override;{$ENDIF}
+    procedure SetAutoSize(Value: Boolean); override;
   public
   public
     constructor Create(AOwner: TComponent); override;
     constructor Create(AOwner: TComponent); override;
     function AdjustHeight: Integer;
     function AdjustHeight: Integer;
@@ -95,38 +85,6 @@ begin
   RegisterComponents('JR', [TNewStaticText]);
   RegisterComponents('JR', [TNewStaticText]);
 end;
 end;
 
 
-procedure DrawTextACP(const DC: HDC; const S: String; var R: TRect;
-  const AFormat: UINT);
-{ Draws an ANSI string using the system's code page (CP_ACP), unlike DrawTextA
-  which uses the code page defined by the selected font. }
-{$IFDEF UNICODE}
-begin
-  DrawText(DC, PChar(S), Length(S), R, AFormat);
-end;
-{$ELSE}
-var
-  SLen, WideLen: Integer;
-  WideStr: PWideChar;
-begin
-  SLen := Length(S);
-  if SLen = 0 then
-    Exit;
-  if Win32Platform = VER_PLATFORM_WIN32_NT then begin
-    if SLen > High(Integer) div SizeOf(WideChar) then
-      Exit;
-    GetMem(WideStr, SLen * SizeOf(WideChar));
-    try
-      WideLen := MultiByteToWideChar(CP_ACP, 0, PChar(S), SLen, WideStr, SLen);
-      DrawTextW(DC, WideStr, WideLen, R, AFormat);
-    finally
-      FreeMem(WideStr);
-    end;
-  end
-  else
-    DrawText(DC, PChar(S), SLen, R, AFormat);
-end;
-{$ENDIF}
-
 { TNewStaticText }
 { TNewStaticText }
 
 
 constructor TNewStaticText.Create(AOwner: TComponent);
 constructor TNewStaticText.Create(AOwner: TComponent);
@@ -234,15 +192,7 @@ begin
   DC := GetDC(0);
   DC := GetDC(0);
   try
   try
     SelectObject(DC, Font.Handle);
     SelectObject(DC, Font.Handle);
-    { On NT platforms, static controls are Unicode-based internally; when
-      ANSI text is assigned to them, it is converted to Unicode using the
-      system code page (ACP). We must be sure to use the ACP here, too,
-      otherwise the calculated size could be incorrect. The code page used
-      by DrawTextA is defined by the font, and not necessarily equal to the
-      ACP, so we can't use it. (To reproduce: with the ACP set to Hebrew
-      (1255), try passing Hebrew text to DrawTextA with the font set to
-      "Lucida Console". It appears to use CP 1252, not 1255.) }
-    DrawTextACP(DC, S, R, DT_CALCRECT or GetDrawTextFlags);
+    DrawText(DC, PChar(S), Length(S), R, DT_CALCRECT or GetDrawTextFlags);
   finally
   finally
     ReleaseDC(0, DC);
     ReleaseDC(0, DC);
   end;
   end;

+ 3 - 12
Components/RestartManager.pas

@@ -1,21 +1,13 @@
 unit RestartManager;
 unit RestartManager;
 
 
 {
 {
-  Basic RestartManager API interface Unit for Delphi 2 and higher
-  by Martijn Laan
+  Basic RestartManager API interface unit by Martijn Laan
 }
 }
 
 
-{$IFNDEF VER90}
-{$IFNDEF VER93}
-  {$DEFINE Delphi3orHigher}
-{$ENDIF}
-{$ENDIF}
-
 interface
 interface
 
 
 uses
 uses
-  {$IFNDEF Delphi3orHigher} OLE2, {$ELSE} ActiveX, {$ENDIF}
-  Windows;
+  ActiveX, Windows;
 
 
 procedure FreeRestartManagerLibrary;
 procedure FreeRestartManagerLibrary;
 function InitRestartManagerLibrary: Boolean;
 function InitRestartManagerLibrary: Boolean;
@@ -151,8 +143,7 @@ function InitRestartManagerLibrary: Boolean;
 begin
 begin
   Inc(ReferenceCount);
   Inc(ReferenceCount);
 
 
-  { Only attempt to load rstrtmgr.dll if running Windows Vista or later }
-  if (RestartManagerLibrary = 0) and (Lo(GetVersion) >= 6) then
+  if RestartManagerLibrary = 0 then
   begin
   begin
     RestartManagerLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + restartmanagerlib));
     RestartManagerLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + restartmanagerlib));
     if RestartManagerLibrary <> 0 then
     if RestartManagerLibrary <> 0 then

+ 1 - 21
Components/RichEditViewer.pas

@@ -72,9 +72,6 @@ uses
   ShellApi, BidiUtils, PathFunc, ComObj;
   ShellApi, BidiUtils, PathFunc, ComObj;
 
 
 const
 const
-  { Note: There is no 'W' 1.0 class }
-  RICHEDIT_CLASS10A = 'RICHEDIT';
-  RICHEDIT_CLASSA = 'RichEdit20A';
   RICHEDIT_CLASSW = 'RichEdit20W';
   RICHEDIT_CLASSW = 'RichEdit20W';
   MSFTEDIT_CLASS = 'RICHEDIT50W';
   MSFTEDIT_CLASS = 'RICHEDIT50W';
   EM_AUTOURLDETECT = WM_USER + 91;
   EM_AUTOURLDETECT = WM_USER + 91;
@@ -116,7 +113,7 @@ type
 
 
   TTextRange = record
   TTextRange = record
     chrg: TCharRange;
     chrg: TCharRange;
-    lpstrText: {$IFDEF UNICODE} PWideChar {$ELSE} PAnsiChar {$ENDIF};
+    lpstrText: PWideChar;
   end;
   end;
 
 
 var
 var
@@ -136,22 +133,12 @@ procedure LoadRichEdit;
 
 
 begin
 begin
   if RichEditUseCount = 0 then begin
   if RichEditUseCount = 0 then begin
-    {$IFDEF UNICODE}
     RichEditVersion := 4;
     RichEditVersion := 4;
     RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'MSFTEDIT.DLL'));
     RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'MSFTEDIT.DLL'));
-    {$ELSE}
-    RichEditModule := 0;
-    {$ENDIF}
     if RichEditModule = 0 then begin
     if RichEditModule = 0 then begin
       RichEditVersion := 2;
       RichEditVersion := 2;
       RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'RICHED20.DLL'));
       RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'RICHED20.DLL'));
     end;
     end;
-    {$IFNDEF UNICODE}
-    if RichEditModule = 0 then begin
-      RichEditVersion := 1;
-      RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'RICHED32.DLL'));
-    end;
-    {$ENDIF}
   end;
   end;
   Inc(RichEditUseCount);
   Inc(RichEditUseCount);
 end;
 end;
@@ -266,17 +253,10 @@ begin
   end;
   end;
   inherited;
   inherited;
   if UseRichEdit then begin
   if UseRichEdit then begin
-    {$IFDEF UNICODE}
     if RichEditVersion = 4 then
     if RichEditVersion = 4 then
       CreateSubClass(Params, MSFTEDIT_CLASS)
       CreateSubClass(Params, MSFTEDIT_CLASS)
     else
     else
       CreateSubClass(Params, RICHEDIT_CLASSW);
       CreateSubClass(Params, RICHEDIT_CLASSW);
-    {$ELSE}
-    if RichEditVersion = 2 then
-      CreateSubClass(Params, RICHEDIT_CLASSA)
-    else
-      CreateSubClass(Params, RICHEDIT_CLASS10A);
-    {$ENDIF}
   end else
   end else
     { Inherited handler creates a subclass of 'EDIT'.
     { Inherited handler creates a subclass of 'EDIT'.
       Must have a unique class name since it uses two different classes
       Must have a unique class name since it uses two different classes

+ 2 - 39
Components/dwTaskbarList.pas

@@ -2,29 +2,21 @@
   http://www.gumpi.com/Blog/2009/01/20/Alpha1OfWindows7ControlsForDelphi.aspx
   http://www.gumpi.com/Blog/2009/01/20/Alpha1OfWindows7ControlsForDelphi.aspx
   MPL licensed } 
   MPL licensed } 
 
 
-{ D2/D3 support and correct IID consts added by Martijn Laan for Inno Setup }
-
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2010 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
   This unit provides the ITaskbarList3 interface for Windows 7 taskbar progress indicators.
   This unit provides the ITaskbarList3 interface for Windows 7 taskbar progress indicators.
-
-  $jrsoftware: issrc/Components/dwTaskbarList.pas,v 1.5 2010/10/21 02:14:14 jr Exp $
 }
 }
 
 
-{$IFDEF VER90}
-  {$DEFINE DELPHI2}
-{$ENDIF}
-
 unit dwTaskbarList;
 unit dwTaskbarList;
 
 
 interface
 interface
 
 
 uses
 uses
-  Windows {$IFDEF DELPHI2}, OLE2 {$ENDIF};
+  Windows;
 
 
 const
 const
   CLSID_TaskbarList: TGUID = (
   CLSID_TaskbarList: TGUID = (
@@ -86,34 +78,6 @@ type
   end;
   end;
 
 
 type
 type
-{$IFDEF DELPHI2}
-  ITaskbarList = class(IUnknown)
-    function HrInit: HRESULT; virtual; stdcall; abstract;
-    function AddTab(hwnd: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function DeleteTab(hwnd: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function ActivateTab(hwnd: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function SetActiveAlt(hwnd: Cardinal): HRESULT; virtual; stdcall; abstract;
-  end;
-
-  ITaskbarList2 = class(ITaskbarList)
-    function MarkFullscreenWindow(hwnd: Cardinal; fFullscreen: Bool): HRESULT; virtual; stdcall; abstract;
-  end;
-
-  ITaskbarList3 = class(ITaskbarList2)
-    function SetProgressValue(hwnd: Cardinal; ullCompleted, ullTotal: dwInteger64): HRESULT; virtual; stdcall; abstract;
-    function SetProgressState(hwnd: Cardinal; tbpFlags: DWORD): HRESULT; virtual; stdcall; abstract;
-    function RegisterTab(hwndTab: Cardinal; hwndMDI: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function UnregisterTab(hwndTab: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function SetTabOrder(hwndTab: Cardinal; hwndInsertBefore: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function SetTabActive(hwndTab: Cardinal; hwndMDI: Cardinal; tbatFlags: DWORD): HRESULT; virtual; stdcall; abstract;
-    function ThumbBarAddButtons(hwnd: Cardinal; cButtons: UINT; Button: THUMBBUTTONLIST): HRESULT; virtual; stdcall; abstract;
-    function ThumbBarUpdateButtons(hwnd: Cardinal; cButtons: UINT; pButton: THUMBBUTTONLIST): HRESULT; virtual; stdcall; abstract;
-    function ThumbBarSetImageList(hwnd: Cardinal; himl: Cardinal): HRESULT; virtual; stdcall; abstract;
-    function SetOverlayIcon(hwnd: Cardinal; hIcon: HICON; pszDescription: LPCWSTR): HRESULT; virtual; stdcall; abstract;
-    function SetThumbnailTooltip(hwnd: Cardinal; pszTip: LPCWSTR): HRESULT; virtual; stdcall; abstract;
-    function SetThumbnailClip(hwnd: Cardinal; prcClip: PRect): HRESULT; virtual; stdcall; abstract;
-  end;
-{$ELSE}
   ITaskbarList = interface
   ITaskbarList = interface
     ['{56FDF342-FD6D-11D0-958A-006097C9A090}']
     ['{56FDF342-FD6D-11D0-958A-006097C9A090}']
     function HrInit: HRESULT; stdcall;
     function HrInit: HRESULT; stdcall;
@@ -143,7 +107,6 @@ type
     function SetThumbnailTooltip(hwnd: Cardinal; pszTip: LPCWSTR): HRESULT; stdcall;
     function SetThumbnailTooltip(hwnd: Cardinal; pszTip: LPCWSTR): HRESULT; stdcall;
     function SetThumbnailClip(hwnd: Cardinal; prcClip: PRect): HRESULT; stdcall;
     function SetThumbnailClip(hwnd: Cardinal; prcClip: PRect): HRESULT; stdcall;
   end;
   end;
-{$ENDIF}
 
 
 implementation
 implementation
 
 

+ 3 - 1
Projects/Compil32.dpr

@@ -46,7 +46,9 @@ uses
   BidiUtils in '..\Components\BidiUtils.pas',
   BidiUtils in '..\Components\BidiUtils.pas',
   DropListBox in '..\Components\DropListBox.pas',
   DropListBox in '..\Components\DropListBox.pas',
   NewCheckListBox in '..\Components\NewCheckListBox.pas',
   NewCheckListBox in '..\Components\NewCheckListBox.pas',
-  NewNotebook in '..\Components\NewNotebook.pas';
+  NewNotebook in '..\Components\NewNotebook.pas',
+  TaskbarProgressFunc in 'TaskbarProgressFunc.pas',
+  HtmlHelpFunc in 'HtmlHelpFunc.pas';
 
 
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SETPEOSVERSION 6.1}
 {$SETPEOSVERSION 6.1}

+ 3 - 0
Projects/Compil32.dproj

@@ -78,6 +78,7 @@
             <MainSource>MainSource</MainSource>
             <MainSource>MainSource</MainSource>
         </DelphiCompile>
         </DelphiCompile>
         <DCCReference Include="SafeDLLPath.pas"/>
         <DCCReference Include="SafeDLLPath.pas"/>
+        <DCCReference Include="..\Components\PathFunc.pas"/>
         <DCCReference Include="CompForm.pas">
         <DCCReference Include="CompForm.pas">
             <Form>CompileForm</Form>
             <Form>CompileForm</Form>
         </DCCReference>
         </DCCReference>
@@ -127,6 +128,8 @@
         <DCCReference Include="..\Components\DropListBox.pas"/>
         <DCCReference Include="..\Components\DropListBox.pas"/>
         <DCCReference Include="..\Components\NewCheckListBox.pas"/>
         <DCCReference Include="..\Components\NewCheckListBox.pas"/>
         <DCCReference Include="..\Components\NewNotebook.pas"/>
         <DCCReference Include="..\Components\NewNotebook.pas"/>
+        <DCCReference Include="TaskbarProgressFunc.pas"/>
+        <DCCReference Include="HtmlHelpFunc.pas"/>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>

+ 2 - 4
Projects/HtmlHelpFunc.pas

@@ -2,13 +2,11 @@ unit HtmlHelpFunc;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2006 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
   Functions for HTML Help
   Functions for HTML Help
-
-  $jrsoftware: issrc/Projects/HtmlHelpFunc.pas,v 1.6 2009/03/23 23:16:44 mlaan Exp $
 }
 }
 
 
 interface
 interface
@@ -56,7 +54,7 @@ begin
   if HHCtrl = 0 then begin
   if HHCtrl = 0 then begin
     HHCtrl := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'hhctrl.ocx'));
     HHCtrl := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'hhctrl.ocx'));
     if HHCtrl <> 0 then
     if HHCtrl <> 0 then
-      HtmlHelp := GetProcAddress(HHCtrl, {$IFDEF UNICODE}'HtmlHelpW'{$ELSE}'HtmlHelpA'{$ENDIF})
+      HtmlHelp := GetProcAddress(HHCtrl, 'HtmlHelpW')
     else
     else
       HtmlHelp := nil;
       HtmlHelp := nil;
    end;
    end;

+ 1 - 16
Projects/MD5.pas

@@ -3,9 +3,6 @@ unit MD5;
 {
 {
   MD5.pas: Translated from C to Delphi by Jordan Russell on 2004-03-16.
   MD5.pas: Translated from C to Delphi by Jordan Russell on 2004-03-16.
   Still in the public domain. The original C code was taken from dpkg.
   Still in the public domain. The original C code was taken from dpkg.
-
-  $jrsoftware: issrc/Projects/MD5.pas,v 1.2 2004/03/16 17:58:14 jr Exp $
-  (based on revision 1.15 from local 'md5' repository)
 }
 }
 
 
 (*
 (*
@@ -32,20 +29,8 @@ unit MD5;
 
 
 interface
 interface
 
 
-{$IFNDEF VER80}
-{$IFNDEF VER90}
-{$IFNDEF VER93}
-{$IFNDEF VER100}
-{$IFNDEF VER110}
-  {$DEFINE MD5_D4PLUS}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-
 type
 type
-  TMD5Word = {$IFDEF MD5_D4PLUS} LongWord {$ELSE} Cardinal {$ENDIF};
+  TMD5Word = LongWord;
   TMD5Buf = array[0..3] of TMD5Word;
   TMD5Buf = array[0..3] of TMD5Word;
   TMD5In = array[0..15] of TMD5Word;
   TMD5In = array[0..15] of TMD5Word;
   TMD5Context = record
   TMD5Context = record

+ 1 - 15
Projects/SHA1.pas

@@ -4,26 +4,12 @@ unit SHA1;
   SHA1.pas: SHA-1 hash implementation, based on RFC 3174 and MD5.pas
   SHA1.pas: SHA-1 hash implementation, based on RFC 3174 and MD5.pas
   Author: Jordan Russell, 2010-02-24
   Author: Jordan Russell, 2010-02-24
   License for SHA1.pas: Public domain, no copyright claimed
   License for SHA1.pas: Public domain, no copyright claimed
-
-  $jrsoftware: issrc/Projects/SHA1.pas,v 1.1 2010/02/25 04:57:34 jr Exp $
 }
 }
 
 
 interface
 interface
 
 
-{$IFNDEF VER80}
-{$IFNDEF VER90}
-{$IFNDEF VER93}
-{$IFNDEF VER100}
-{$IFNDEF VER110}
-  {$DEFINE SHA1_D4PLUS}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-{$ENDIF}
-
 type
 type
-  TSHA1Word = {$IFDEF SHA1_D4PLUS} LongWord {$ELSE} Cardinal {$ENDIF};
+  TSHA1Word = LongWord;
   TSHA1Buf = array[0..4] of TSHA1Word;
   TSHA1Buf = array[0..4] of TSHA1Word;
   TSHA1In = array[0..15] of TSHA1Word;
   TSHA1In = array[0..15] of TSHA1Word;
   TSHA1WArray = array[0..79] of TSHA1Word;
   TSHA1WArray = array[0..79] of TSHA1Word;

+ 2 - 1
Projects/Setup.dpr

@@ -82,7 +82,8 @@ uses
   RestartManager in '..\Components\RestartManager.pas',
   RestartManager in '..\Components\RestartManager.pas',
   Resample in '..\Components\Resample.pas',
   Resample in '..\Components\Resample.pas',
   dwTaskbarList in '..\Components\dwTaskbarList.pas',
   dwTaskbarList in '..\Components\dwTaskbarList.pas',
-  ASMInline in '..\Components\ASMInline.pas';
+  ASMInline in '..\Components\ASMInline.pas',
+  TaskbarProgressFunc in 'TaskbarProgressFunc.pas';
 
 
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SetPEFlags IMAGE_FILE_RELOCS_STRIPPED}
 {$SETPEOSVERSION 6.1}
 {$SETPEOSVERSION 6.1}

+ 1 - 0
Projects/Setup.dproj

@@ -157,6 +157,7 @@
         <DCCReference Include="..\Components\Resample.pas"/>
         <DCCReference Include="..\Components\Resample.pas"/>
         <DCCReference Include="..\Components\dwTaskbarList.pas"/>
         <DCCReference Include="..\Components\dwTaskbarList.pas"/>
         <DCCReference Include="..\Components\ASMInline.pas"/>
         <DCCReference Include="..\Components\ASMInline.pas"/>
+        <DCCReference Include="TaskbarProgressFunc.pas"/>
         <BuildConfiguration Include="Base">
         <BuildConfiguration Include="Base">
             <Key>Base</Key>
             <Key>Base</Key>
         </BuildConfiguration>
         </BuildConfiguration>

+ 8 - 15
Projects/TaskbarProgressFunc.pas

@@ -2,13 +2,11 @@ unit TaskbarProgressFunc;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2010 Jordan Russell
+  Copyright (C) 1997-2024 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
   Wrappers for ITaskbarList3.SetProgressState & SetProgressValue
   Wrappers for ITaskbarList3.SetProgressState & SetProgressValue
-
-  $jrsoftware: issrc/Projects/TaskbarProgressFunc.pas,v 1.1 2010/10/29 01:48:45 jr Exp $
 }
 }
 
 
 interface
 interface
@@ -23,7 +21,7 @@ procedure SetAppTaskbarProgressValue(const Completed, Total: Cardinal);
 implementation
 implementation
 
 
 uses
 uses
-  Windows, {$IFDEF VER90} OLE2 {$ELSE} ActiveX {$ENDIF}, Forms, dwTaskbarList;
+  Windows, ActiveX, Forms, dwTaskbarList;
 
 
 var
 var
   TaskbarListInitialized: Boolean;
   TaskbarListInitialized: Boolean;
@@ -31,20 +29,15 @@ var
 
 
 function InitializeTaskbarList: Boolean;
 function InitializeTaskbarList: Boolean;
 var
 var
-  WinVer: Word;
   Intf: ITaskbarList3;
   Intf: ITaskbarList3;
 begin
 begin
   if not TaskbarListInitialized then begin
   if not TaskbarListInitialized then begin
-    WinVer := Swap(Word(GetVersion()));
-    if WinVer >= $0601 then
-      if CoCreateInstance(CLSID_TaskbarList, nil, CLSCTX_INPROC_SERVER, IID_TaskbarList3, Intf) = S_OK then
-        if Intf.HrInit = S_OK then begin
-          {$IFNDEF VER90}
-          { Safety: don't allow the instance to be destroyed at shutdown }
-          Intf._AddRef;
-          {$ENDIF}
-          TaskbarListInterface := Intf;
-        end;
+    if CoCreateInstance(CLSID_TaskbarList, nil, CLSCTX_INPROC_SERVER, IID_TaskbarList3, Intf) = S_OK then
+      if Intf.HrInit = S_OK then begin
+        { Safety: don't allow the instance to be destroyed at shutdown }
+        Intf._AddRef;
+        TaskbarListInterface := Intf;
+      end;
     TaskbarListInitialized := True;
     TaskbarListInitialized := True;
   end;
   end;
   Result := Assigned(TaskbarListInterface);
   Result := Assigned(TaskbarListInterface);