mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2024-11-09 17:50:30 +01:00
Build regular Windows programs using KoW {$IFNDEF Debug}
This commit is contained in:
parent
5f3fca1705
commit
65ad809822
@ -2,5 +2,6 @@
|
||||
OutputDir=..\..\..\Bin\KoW
|
||||
UnitOutputDir=..\..\..\Bin\KoW\DCU
|
||||
SearchPath=..\..\..\Lib;..\..\..\Bin\KoW\DCU
|
||||
Conditionals=Debug
|
||||
UnitAliases=
|
||||
UsePackages=0
|
@ -87,8 +87,8 @@ var
|
||||
procedure InitConsole(Title: PKolibriChar; CloseWindowOnExit: Boolean;
|
||||
WndWidth, WndHeight, ScrWidth, ScrHeight: LongWord);
|
||||
begin
|
||||
con_init(WndWidth, WndHeight, ScrWidth, ScrHeight, Title);
|
||||
CloseWindow := CloseWindowOnExit;
|
||||
con_init(WndWidth, WndHeight, ScrWidth, ScrHeight, Title);
|
||||
if ScrWidth <> LongWord(-1) then
|
||||
ClrEOLWidth := ScrWidth;
|
||||
end;
|
||||
@ -278,11 +278,13 @@ initialization
|
||||
InitKoW;
|
||||
{$ENDIF}
|
||||
|
||||
{$IF defined(KolibriOS) or defined(Debug)}
|
||||
if IsConsole then
|
||||
InitConsole(AppPath);
|
||||
|
||||
finalization
|
||||
if Assigned(System.con_exit) then
|
||||
con_exit(CloseWindow);
|
||||
{$IFEND}
|
||||
|
||||
end.
|
||||
|
@ -73,16 +73,21 @@ begin
|
||||
end;
|
||||
|
||||
procedure con_init(WndWidth, WndHeight, ScrWidth, ScrHeight: LongWord; Title: PKolibriChar); stdcall;
|
||||
{$IFDEF Debug}
|
||||
var
|
||||
Font: TConsoleFontInfo;
|
||||
R: TSmallRect;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF Debug}
|
||||
if not IsConsole then
|
||||
AllocConsole;
|
||||
{$ENDIF}
|
||||
|
||||
TTextRec(Input).Handle := System.GetStdHandle(STD_INPUT_HANDLE);
|
||||
TTextRec(Output).Handle := System.GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
{$IFDEF Debug}
|
||||
SaveInputCP := GetConsoleCP;
|
||||
SetConsoleCP(CP_KOLIBRIOS);
|
||||
SaveOutputCP := GetConsoleOutputCP;
|
||||
@ -95,8 +100,9 @@ begin
|
||||
if WndHeight <> LongWord(-1) then
|
||||
WndSize.Y := WndHeight;
|
||||
|
||||
MainWindow := GetConsoleWindow;
|
||||
GetCurrentConsoleFont(TTextRec(Output).Handle, False, Font);
|
||||
SetWindowPos(GetConsoleWindow, 0, WndPos.X, WndPos.Y,
|
||||
SetWindowPos(MainWindow, 0, WndPos.X, WndPos.Y,
|
||||
Font.Size.X * WndSize.X + GetSystemMetrics(SM_CXVSCROLL), Font.Size.Y * WndSize.Y + GetSystemMetrics(SM_CYHSCROLL), 0);
|
||||
|
||||
if ScrWidth <> LongWord(-1) then
|
||||
@ -113,6 +119,7 @@ begin
|
||||
Bottom := ScrSize.Y - 1;
|
||||
end;
|
||||
SetConsoleWindowInfo(TTextRec(Output).Handle, True, R);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function con_get_cursor_height: Integer; stdcall;
|
||||
|
@ -38,23 +38,26 @@ const
|
||||
EOL: array[0..1] of KolibriChar = #13#10;
|
||||
var
|
||||
Buf: array[Low(Byte)..High(Byte) + 1] of KolibriChar;
|
||||
BytesWritten, Flags: Cardinal;
|
||||
{$IFNDEF Debug}
|
||||
BytesWritten: LongWord;
|
||||
{$ENDIF}
|
||||
Flags: LongWord;
|
||||
begin
|
||||
{$IFNDEF Debug}
|
||||
if TTextRec(Output).Handle <> 0 then
|
||||
begin
|
||||
WriteFile(TTextRec(Output).Handle, Msg^, Count, BytesWritten, nil);
|
||||
WriteFile(TTextRec(Output).Handle, EOL, SizeOf(EOL), BytesWritten, nil);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if MainWindow <> 0 then
|
||||
Flags := MB_ICONERROR
|
||||
else
|
||||
Flags := MB_ICONERROR or MB_TASKMODAL;
|
||||
Move(Msg^, Buf, Count);
|
||||
Msg[Count] := #0;
|
||||
MessageBox(MainWindow, Msg, nil, Flags);
|
||||
Exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
if MainWindow <> 0 then
|
||||
Flags := MB_ICONERROR
|
||||
else
|
||||
Flags := MB_ICONERROR or MB_TASKMODAL;
|
||||
Move(Msg^, Buf, Count);
|
||||
Msg[Count] := #0;
|
||||
MessageBox(MainWindow, Msg, nil, Flags);
|
||||
end;
|
||||
|
||||
function SysFreeMem(P: Pointer): Integer;
|
||||
|
1
My/.dof
1
My/.dof
@ -2,5 +2,6 @@
|
||||
OutputDir=..\..\Bin\KoW
|
||||
UnitOutputDir=..\..\Bin\KoW\DCU
|
||||
SearchPath=..\..\Lib;..\..\Bin\KoW\DCU
|
||||
Conditionals=Debug
|
||||
UnitAliases=
|
||||
UsePackages=0
|
@ -4,7 +4,7 @@ set DCU=%~dp0Bin\DCU
|
||||
set KoW=%~dp0Bin\KoW\DCU
|
||||
|
||||
if #%1#==## (
|
||||
call "%~dp0Tools\init.bat"
|
||||
call "%~dp0Tools\init.bat" -dDebug
|
||||
if errorlevel 1 goto exit
|
||||
|
||||
if not exist "%KoW%" mkdir "%KoW%"
|
||||
|
Loading…
Reference in New Issue
Block a user