aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatformWindows.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-28 16:35:34 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-11-28 16:35:34 +0000
commit64de8825666fcb234fb31b4c716cf1c9fbcaacfe (patch)
tree027687d4a8fca4ca73565ce32b74a7c1616ea57e /Game/Code/Classes/UPlatformWindows.pas
parent80f3f5fe438a48b94a2ec9c70e6ff8475ede4ff3 (diff)
downloadusdx-64de8825666fcb234fb31b4c716cf1c9fbcaacfe.tar.gz
usdx-64de8825666fcb234fb31b4c716cf1c9fbcaacfe.tar.xz
usdx-64de8825666fcb234fb31b4c716cf1c9fbcaacfe.zip
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
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UPlatformWindows.pas54
1 files changed, 33 insertions, 21 deletions
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;