Help Controlling external console app

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Perkes

    #1

    Help Controlling external console app

    I have a legacy console application that I need to
    control with a c# desktop application. The main
    functionality i need is the following:

    Send strings
    Read strings at specific locations
    Send function keys (F3, F4, etc)

    I have used the code from Extended Functionality for
    System.Console
    (http://www.gotdotnet.com/Community/U...les/Details.as
    px?SampleGuid=b 76d1f08-2d79-47bd-825b-0489938aae0f) and
    have been able to attach to the console application's
    process using AttachConsole and GetStdHandle Win32 API
    functions, but can't seem to figure out how to send
    strings to the console app or read output from the app
    into a string.

    Can anyone help?

    Thanks,


  • Vijaye Raji

    #2
    Re: Help Controlling external console app

    Check out WriteConsoleInp ut/Output and ReadConsoleOutp ut/Input APIs

    -vJ

    "Doug Perkes" <douglas.a.perk es@nospamhere.b ankofamerica.co m> wrote in
    message news:00a001c3b9 b3$998cc550$a10 1280a@phx.gbl.. .[color=blue]
    > I have a legacy console application that I need to
    > control with a c# desktop application. The main
    > functionality i need is the following:
    >
    > Send strings
    > Read strings at specific locations
    > Send function keys (F3, F4, etc)
    >
    > I have used the code from Extended Functionality for
    > System.Console
    > (http://www.gotdotnet.com/Community/U...les/Details.as
    > px?SampleGuid=b 76d1f08-2d79-47bd-825b-0489938aae0f) and
    > have been able to attach to the console application's
    > process using AttachConsole and GetStdHandle Win32 API
    > functions, but can't seem to figure out how to send
    > strings to the console app or read output from the app
    > into a string.
    >
    > Can anyone help?
    >
    > Thanks,
    >
    >[/color]


    Comment

    Working...