VB.NET question

  • I know this isn't exactly the right forum/board for this, so if you have an idea where to ask, or how to go about this, I'd be grateful.

    I'm trying to run a legacy (COBOL) application from a VB.NET program.  (The connection to SQL is that I want to feed data from the DB to the application, and then capture the results off the screen to update the DB.)

    The application runs in a command window, similar to the 2000/XP command window, 80x25 characters.  I can start the process, use SendKeys to feed it the data and generate the results. 

    There is where I'm stumped.  If I manually use the Edit/Mark and Edit/Copy options to select the whole screen, when I close the application my VB.NET program gets the results okay.  What I'd like to do is to somehow control the Mark and Copy operations to grab the data programmatically.  I'm pretty sure it will involve using SendMessage, but I can't find a way to manipulate the menu or cursor operations.

    Any ideas?

    So long, and thanks for all the fish,

    Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3

  • This is the most weird thing I've ever heard of. Why not create a bitmap in .NET and paste it directly in the memory of the legacy system? 😉

    I apologize, but I couldn't keep my fingers from typing ...


    _/_/_/ paramind _/_/_/

  • I assume you are starting the cobol app using Process.Start method.  Are you using the overloaded version that uses the ProcessStartInfo class?  Have you tried to use this to capture StandardOutput to a TextStream in your application?

    I ask these to see if you tried this.  It depends on the application if these will be successful or not.  The app may be using StdIn/StdOut/StdErr to read keystrokes or write to the screen.  If so, you should be able to control the app using this.  If not, I'm not sure.  I suspect you can capture the contents of any window, but I'm not sure how, or what to do with it (extract text data) when you have it.

    Hope this helps.  And you have permissions to ignore those who have not ever been challenged in their work, and ridicule a not uncommon application technique called screen-scraping.



    Mark

  • ... and you have of course no permission to ignore godfather

    post scriptum: godfather is of course informed of all the challenges his little sheep have gone through. so, godfather, please tell me: what have I had for breakfest today?


    _/_/_/ paramind _/_/_/

  • I am using the overloaded version with process info, because redirecting stdout was the first thing I tried.  From the appearance of the output, it looks like it's using direct IO (probably to the screen segment, like we used to do way, way back when). 

    There is a print report option that I could possibly use if there was a way to redirect stdprint.  But process info has no ability to redirect stdprint that I could find. 

    I hate to rely on the operator to type the couple of bits of relevant data into a text box, but even that would be better than what they are doing now.

    So long, and thanks for all the fish,

    Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3

  • It's not as elegant as scraping the screen, but I have set up an LPT1: Print to Text driver.  Still, if anyone else has screen scraping  a solution, please let me know.

    So long, and thanks for all the fish,

    Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3

  • So more than a month later, I picked up this app again, and within minutes had the solution (found on the net, of course).  The keystroke combination I was looking for is Alt-Space, which brings up the DOS box menu that has the Edit/Mark function.

    The application is a little silly looking to watch, but it will make a largely manual, error-prone process that takes about 1-2 minutes per item to just about 1 second and two button clicks -- and no keystroke errors! 

     

    So long, and thanks for all the fish,

    Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply