#include <windows.h>
//sending text
// send every char
for (int i=0;i<length;i++) SendMessage(hwnd,WM_CHAR ,command[i],1);
// and the CR
SendMessage(hwnd,WM_CHAR ,13,1);
//reading text
SendMessage(hwnd,WM_GETTEXT ,(WPARAM)sizeof(console),(LPARAM) console);
//clearing conosle
SendMessage(hwnd,WM_SETTEXT ,(WPARAM)NULL,(LPARAM)"");