VB.net writing into console

hii!

ive got a question,

How do i send and retrieve things from the console with VB.net?

i need the code for it, to make some funny things =D

<33 u!

kiss strZ
Comments
14
ask abort
#-=[bzz]=- hackersclan! ;)
who to ask? =D
Parent
tziek or dis4ea
Parent
haxor.. notrly, dunno, hope you get it done =)
get the console window hwnd (findwindow) and use the sendmessage api.
<3 u abortie
Parent
use C++..

Quote

HWND hConWin;
HWND hCmd;

hConWin = FindWindowEx(NULL, NULL, NULL, "ET Console");
if(NULL == hConWin)
return FALSE;

if(showConsole)
ShowWindow(hConWin, SW_SHOW); // Display the console window
else
ShowWindow(hConWin, SW_HIDE);

hCmd = FindWindowEx(hConWin, NULL, "Edit", NULL);
if(NULL == hCmd)
return FALSE;


Then you simply send the text and a return character to the edit box:

Quote

SendMessage(hCmd, WM_SETTEXT, NULL, (LPARAM)"say hi2u!"); // sends "say hi2u!" to the console
SendMessage(hCmd, WM_CHAR, 13, 1); // simulates the enter key


You'll have to translate from C++ to VB yourself, but if I were u I would just use C++ :o)
Ask _evan
found it:

QuotePrivate Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Integer

Private Declare Function ShowWindow Lib "user32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As integer


Function OpenConsole()
ShowWindow (FindWindow(vbNullString, "ET Console")), 1
End Function

Function CloseConsole()
ShowWindow (FindWindow(vbNullString, "ET Console")), 0
End Function

Private Sub Command1_Click()
Call OpenConsole
End Sub

Private Sub Command2_Click()
Call CloseConsole
End Sub
Back to top