* better restore console mode for windows

git-svn-id: trunk@6124 -
This commit is contained in:
pierre 2007-01-22 04:17:06 +00:00
parent 90c85b198a
commit 118ee9a8ab

View File

@ -695,9 +695,12 @@ end;
function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
{$ifdef Windows}
var
mode : word;
mode,modebefore : word;
{$endif Windows}
Begin
{$ifdef Windows}
GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @modebefore);
{$endif Windows}
RedirErrorOut:=0; RedirErrorIn:=0; RedirErrorError:=0;
ExecuteResult:=0;
IOStatus:=0;
@ -715,10 +718,10 @@ Begin
(RedirErrorIn=0) and (RedirErrorError=0) and
(ExecuteResult=0);
{$ifdef Windows}
// reenable mouse events
// restore previous mode
GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @mode);
mode:=mode or ENABLE_MOUSE_INPUT;
SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), mode);
//mode:=mode or ENABLE_MOUSE_INPUT;
SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), modebefore);
{$endif Windows}
End;