To be honest, I tried to find a tittle for this but i couldn't think of any
I'm creating an application using visual basic 2010 that i will be using/running on Backtrack 5 R3, I tried it and it works fine, But i needed to add a Terminal to the application, Instead of opening Terminal on backtrack, I want to have it built in my application
Any idea guys how to do that?
thanks :)
This is the code that i had to add windows Command "CMD", But this works with Windows ONLY
>
>
>

ublic Class Form1
    Private WithEvents MyProcess As Process
    Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Width = 488
        Me.AcceptButton = Button1
        MyProcess = New Process
        With MyProcess.StartInfo
            .FileName = "CMD.EXE"
            .UseShellExecute = False
            .CreateNoWindow = True
            .RedirectStandardInput = True
            .RedirectStandardOutput = True
            .RedirectStandardError = True
        End With
        MyProcess.Start()
        MyProcess.BeginErrorReadLine()      'start async read on stderr
        MyProcess.BeginOutputReadLine()     'start async read on stdout
        AppendOutputText("Process Started at: " & MyProcess.StartTime.ToString)
    End Sub
    Private Sub MyProcess_ErrorDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.ErrorDataReceived
        AppendOutputText(vbCrLf & "Error: " & e.Data)
    End Sub

    Private Sub MyProcess_OutputDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.OutputDataReceived
        AppendOutputText(vbCrLf & e.Data)
    End Sub

    Private Sub AppendOutputText(ByVal text As String)
        If OutputTextBox.InvokeRequired Then
            Dim myDelegate As New AppendOutputTextDelegate(AddressOf AppendOutputText)
            Me.Invoke(myDelegate, text)
        Else
            OutputTextBox.AppendText(text)
        End If
    End Sub
    'button1 coding
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MyProcess.StandardInput.WriteLine(InputTextBox.Text)
        MyProcess.StandardInput.Flush()
    End Sub
End Class

Recommended Answers

All 15 Replies

not sure if this will work for you but the code in this post does create a generic console in a forms application. Basically you have a form and a terminal. The terminal works via the Console class. It's in c# but I just compiled it as a Class Library and imported the resulting .dll into a vb app. Careful the original code is missing some using statements but they're itemized in a following post

Thanks tinstaafl for your respond
I do have the C# too, But what i have seen/Understood from the "Post/Link" you added with your reply was kind of talking about windows, Im not actually good at programming, And if im mistaken, Please correct me, what i needed is like adding the Backtrack5 terminal into my application, So i can use the terminal just from my application
Please help because i couldn't find any sign/solution for it online :(
thanks again

Something to do with for example 2 textboxes, One will be the input and the second one will be the output, What ever you will type in the input>> will come up on the output just like using the Terminal Command

It sounds like, in order to run your app on BasckTrack you must have a wrapper to interpret the code. Unless that wrapper has a library that you can access I don't think there's a simple way to do what you ask.

Do you recommend any good tittle to help me find it please
Thanks for your time :)

Sorry without knowing the exact details of how you're running a windows app on a linux OS, it would be very difficult to even suggest where to look.

Ok, I'm aiming to develop an application in Visual basic or C# that will be having like a Textbox1 in the form1, And this application will be used as you are using the "backtrack5 Terminal-Command lne" and run it on Backtrack
the above coding that i posted is to add the windows CMD 'command' in your application, But that to be used on Windows only, It actually have got two textboxes, The inpout and the output
Now wanted to do the same as i did with the windows CMD, But with Backtrack terminal comman line built in it too so it can work on the backtrack
To run an .EXE file on backtrack, i have to use the MONO 2.10.8 for windows
I have tried to use the windows CMD on backtrack5, But it doesn't do the same job as the backtrack terminal command line
I apologise if im making it even more complicated, Because my english isn't good enough to explain it in a higher level as i'm actually new to programming
Thanks a lot :)

Did you try my earlier post about a generic terminal? Because it's not tied to a specific windows shell, like CMD, you may have more luck. Also I took a look at the Mono website. They have a gresat many options there for interfacing .net apps to linux. This sound like the best place to find out whether what you want to do is possible

Hi tinstaafl, I did actually tried the codes you gave me in the (Post) link, But it didn't work, I will be really really pleased if you could make a project for me send it to me please if that won't waste your time or take a long time to get it done
I have atually looked every where, But i couldn't find the solution for it and i really need it
Thanks for all your replays and helps :)

That wouldn't really be practical as I don't have a linux system to test it on. I think though that using the Mono api would still be your best bet. Instead of using it to run your windows code, try using it to cross compile your code for linux.

And how to do that please comppile the code for linux ?

You'll have to check the docs for Mono API

Careful the original code is missing some using statements but they're itemized in a following post

hi
this is hard code for backtrack terminal in visual basic.

is any any chance to get it done in C or C++ or programming language that i can use on Windows ?
I have been looking for it and i couldn't find it at all :S

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.