[HELP] Fake Command Prompt
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
has anyone come up with a why to create a Fake CMD Terminal that will accept string arguments?
if so please share. i could use a good working example.
i ask cause i am trying to create a game, well rather re-create a game and i need a "fake" command propmt to allow for command inputs.
if so please share. i could use a good working example.
i ask cause i am trying to create a game, well rather re-create a game and i need a "fake" command propmt to allow for command inputs.
I suppose you could just use Console.Write and Console.WriteLine to simulate the output from a command prompt.
You can use Console.ReadLine to store the arguments.
If you are using a Forms based application then you can use the AllocConsole function to display the console window.
You can use Console.ReadLine to store the arguments.
If you are using a Forms based application then you can use the AllocConsole function to display the console window.
Code: Select all
<DllImport("kernel32.dll")> Shared Function AllocConsole() As Boolean
End Function
<DllImport("kernel32.dll")> Shared Function FreeConsole() As Boolean
End Function
Sub consoleThread()
AllocConsole()
While True
Console.WriteLine("test")
Dim input As String = Console.ReadLine()
End While
End Sub
Dim t As Thread = New Thread(AddressOf consoleThread)
Private Sub btnConsole_Click(sender As System.Object, e As System.EventArgs) Handles btnConsole.Click
'2nd thread needed so it doesn't freeze up the GUI on ReadLine
t.Start()
End Sub
mandai wrote:I suppose you could just use Console.Write and Console.WriteLine to simulate the output from a command prompt.this is kinda of what i am thinking.
You can use Console.ReadLine to store the arguments.
If you are using a Forms based application then you can use the AllocConsole function to display the console window.Code: Select all<DllImport("kernel32.dll")> Shared Function AllocConsole() As Boolean End Function <DllImport("kernel32.dll")> Shared Function FreeConsole() As Boolean End Function Sub consoleThread() AllocConsole() While True Console.WriteLine("test") Dim input As String = Console.ReadLine() End While End Sub Dim t As Thread = New Thread(AddressOf consoleThread) Private Sub btnConsole_Click(sender As System.Object, e As System.EventArgs) Handles btnConsole.Click '2nd thread needed so it doesn't freeze up the GUI on ReadLine t.Start() End Sub
but instead of a consoleFree opening,
it would be more like a usercontrol with a label (for output) and a textbox for input.
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023