From 64de8825666fcb234fb31b4c716cf1c9fbcaacfe Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 28 Nov 2007 16:35:34 +0000 Subject: fixed lazarus build-error due to differing declarations of FindFirstFileW and FindNextFileW (var vs pointer) in delphi and lazarus git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@655 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformWindows.pas | 54 +++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas index afdcebcf..93e72e7a 100644 --- a/Game/Code/Classes/UPlatformWindows.pas +++ b/Game/Code/Classes/UPlatformWindows.pas @@ -11,7 +11,7 @@ interface uses Classes, UPlatform; type - + TPlatformWindows = class(TPlatform) public Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override; @@ -23,7 +23,7 @@ implementation uses SysUtils, Windows; type - + TSearchRecW = record Time: Integer; Size: Integer; @@ -45,7 +45,11 @@ const faSpecial = faHidden or faSysFile or faVolumeID or faDirectory; begin F.ExcludeAttr := not Attr and faSpecial; +{$IFDEF Delphi} F.FindHandle := FindFirstFileW(PWideChar(Path), F.FindData); +{$ELSE} + F.FindHandle := FindFirstFileW(PWideChar(Path), @F.FindData); +{$ENDIF} if F.FindHandle <> INVALID_HANDLE_VALUE then begin Result := FindMatchingFileW(F); @@ -56,7 +60,11 @@ end; function FindNextW(var F: TSearchRecW): Integer; begin +{$IFDEF Delphi} if FindNextFileW(F.FindHandle, F.FindData) then +{$ELSE} + if FindNextFileW(F.FindHandle, @F.FindData) then +{$ENDIF} Result := FindMatchingFileW(F) else Result := GetLastError; @@ -78,7 +86,11 @@ begin with F do begin while FindData.dwFileAttributes and ExcludeAttr <> 0 do +{$IFDEF Delphi} if not FindNextFileW(FindHandle, FindData) then +{$ELSE} + if not FindNextFileW(FindHandle, @FindData) then +{$ENDIF} begin Result := GetLastError; Exit; @@ -101,31 +113,31 @@ begin end; //------------------------------ -//Start more than One Time Prevention -//------------------------------ +//Start more than One Time Prevention +//------------------------------ function TPlatformWindows.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; var hWnd: THandle; - I: Integer; + I: Integer; begin Result := false; hWnd:= FindWindow(nil, PChar(WndTitle)); - //Programm already started - if (hWnd <> 0) then - begin - I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); - if (I = IDYes) then - begin - I := 1; - repeat - Inc(I); - hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); - until (hWnd = 0); - WndTitle := WndTitle + ' Instance ' + InttoStr(I); - end - else - Result := true; - end; + //Programm already started + if (hWnd <> 0) then + begin + I := Messagebox(0, PChar('Another Instance of Ultrastar is already running. Continue ?'), PChar(WndTitle), MB_ICONWARNING or MB_YESNO); + if (I = IDYes) then + begin + I := 1; + repeat + Inc(I); + hWnd := FindWindow(nil, PChar(WndTitle + ' Instance ' + InttoStr(I))); + until (hWnd = 0); + WndTitle := WndTitle + ' Instance ' + InttoStr(I); + end + else + Result := true; + end; end; Function TPlatformWindows.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; -- cgit v1.2.3