.net console app text-based "graphics"

Discussion in 'OT Technology' started by P07r0457, Sep 1, 2007.

  1. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    I need to create an app, and the ability to access it via "terminal" at each machine, with it running centrally would be quite nice. I have looked at the System.Console class, as well as JConsole, and nothing seems to support the functionality that I need. I need to be able to insert "text fields" that can be tabbed between, as well as "window" support, so I can pop a window, and subsequently dismiss the window which would display over the text (within the same console).

    Does anyone have any references they could point me towards? If you can get me enough to demonstrate the text fields and what not (I would much prefer to use vb.net) then I think it's worth a t-shirt from thinkgeek, or something comprable of your choosing.
     
  2. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    geez guys, can no one provide me with this? It seems like a simple request... Does no one know of a website or book that goes into the development of user-friendly console applications?


    If anyone wants to know, I'm trying to provide an application served via the windows platform through a telnet/ssh-type terminal a la 3270/as400.

    Come on guys.... It's not often that someone baits it with a gift! Help a brotha out!
     
  3. Jables

    Jables OT Supporter

    Joined:
    Jul 27, 2007
    Messages:
    6
    Likes Received:
    0
    I'm just a noob when it comes to .net so I won't be much help, but to handle the network connections you need to use System.Net and System.Net.Sockets. The .Net framework developer center has a lot of sample code that comes in very useful when you're lost. Here's a code snippet me and my partner used for our IS class.

    Code:
    Imports System.Net
    Imports System.Net.Sockets
    
    Module Module1
    
        Sub Main()
            Dim backlog As Integer 'This is the number of concurrent connections that can be queued
            Dim port As Integer 'Set Equal to port SSH/Telnet connects on
    
            ' create socket
            Dim listenSocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    
            ' bind the listening socket to the port defined above
            Dim hostIP As IPAddress = Dns.GetHostEntry(IPAddress.Any.ToString()).AddressList(0)
            Dim ep As New IPEndPoint(hostIP, port)
            listenSocket.Bind(ep)
    
            ' start the listening process
            listenSocket.Listen(backlog)
        End Sub
    
    End Module
    Just a simple program that listens on a port, used sample code from the MSDN and modified it to work with VS2005. What you do with the data from there I have no clue, we used ours to display data generated by a Perl program on another machine. I'm also 99% sure that there's a better way to do it, but hopefully this gets you going in the right direction.
     
  4. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    that does nothing of what I want.

    I can code the functionality easy-breezy. I can do a gui in a day. But for what I need, it needs to be console-based. To serve it over the network, i'll run it over telnet/ssh -- so no worries there.

    I need a framework that handles text-based "graphics", text input fields, handling tabs and "function" keys, windowing, etc.
     
  5. EvilSS

    EvilSS New Member

    Joined:
    Jun 11, 2003
    Messages:
    5,104
    Likes Received:
    0
    Location:
    STL
    AFAIK there is no out-of-the-box solution to what you want to do in .net. People just don't do console level programs with UI's like that any more. You are going to have to build it yourself. Shouldn't be that hard, the key is to layout the screens, figure out the x,y for the input fields, move the cursor to the first one, then trap the input, filtering for your control keys (tab, ctrl-tab, arrows, enter, etc). These two projects should get you started. The first covers a lot of what you want, but it is in C# (you'll have to translate it, but the guts are there). The project file is on page 5, at the bottom. Pay special attention to the bufftest and readtest programs (they are not the default in the project, so after you build it, you have to go run them from their bin folders or make one the default).

    http://www.devsource.com/article2/0,1895,2005767,00.asp

    This one is in VB (even though it says C#, it includes VB) and has some of the API calls you need, already shown in VB.

    http://www.mentalis.org/soft/class.qpx?id=2

    Of course, YMMV using these via telnet. It's possible some of the screen manipulations won't translate across from a true console to a telnet session.
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    yea, I'll definitely have to mess with it. Thank you for at least giving me a starting place. I wanted to avoid having to write my own, but if that's what's needed, we'll check it out. Originally I wanted to do this in java to gain cross-platform support... But java just does NOT like the console.
     
  7. R-Type

    R-Type The Bydo Empire must die!

    Joined:
    Aug 2, 2002
    Messages:
    1,049
    Likes Received:
    0
    Location:
    CT
    How about http://pdcurses.sourceforge.net? It's written in C and ported to windows natively. No cygwin required. Comes with .mak files for vstudio, mingw (native win32 gcc/binutils), lcc, and borland CPP for windows.

    The cheesy demos it compiles seem to do what you're looking for, though, you'd have to code your own sockets interface if you want to pump the screens out to remote users. see tuidemo.exe, newdemo.exe, and testcurs.exe to see what I'm talking about.

    public domain license.
     

Share This Page