Fixed:
=======================
unit main;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
interfaceuses
 
mseglob,mseapplication,mseclasses,msedatamodules,msepipestream,mseprocess,msestrings;

type
 tmainmo = class(tmsedatamodule)   process: tmseprocess;
   procedure pipebrokenexe(const sender: tpipereader);
   procedure inputavailexe(const sender: tpipereader);
   procedure loadedexe(const sender: TObject);
   procedure finished(const sender: TObject);
 end;

var
 mainmo: tmainmo;
 output: msestringarty;

implementation

uses
  main_mfm,msesysintf,sysutils,msearrayutils,{$ifdef mswindows}windows{$endif};

procedure tmainmo.pipebrokenexe(const sender: tpipereader);
begin
  exitcode:= 1;
  application.terminated:= true;
end;

procedure tmainmo.inputavailexe(const sender: tpipereader);
var
 str1: string;
begin
 if sender.readstrln(str1) then begin
   additem(output,str1); end;
end;

procedure tmainmo.loadedexe(const sender: TObject);
begin  process.filename:= 'route print';
  process.active:= true;
end;

procedure tmainmo.finished(const sender: TObject);
var
  ar1: msestringarty;
  i:integer;
  {$ifdef mswindows}  info: osversioninfo;
  {$endif}begin
  exitcode:= 1;
  {$ifdef mswindows}    info.dwOSVersionInfoSize:= sizeof(info);
  if getversionex(info) then begin    if not (info.dwmajorversion in
[5,6]) then begin
      writeln('unsupported OS version: ', info.dwmajorversion);    end
else begin      for i:= 0 to high(output) do begin        ar1:=
splitstring(output[i],' ');
        if (ar1[0] = '255.255.255.255') and (ar1[0] = ar1[1]) then
begin          if info.dwmajorversion = 5 then begin
            if (ar1[2] = ar1[3]) and (ar1[3] <> '127.0.0.1') then begin
              writeln(ar1[3]);
            end;
          end else
          if info.dwmajorversion = 6 then begin
            if (ar1[2] = 'On-link') and (ar1[3] <> '127.0.0.1') then begin
              writeln(ar1[3]);
            end;          end;      end;      end;
    end;
    exitcode:= 0;
  end;
  {$else}
  {$endif}  application.terminated:= true;
end;

end.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to