Im trying to learn how to use the winapi - ive read tutorials about message handling and the windows procedure ect, but am a bit lost as to where to start.

I know what i want to do - my program launches as a console and starts a new thread for a window. ideally, i would like to hide the original console, and only have the window, and then have buttons that send preset cin input to the console, and have the cout returned to and displayed somewhere in the window. it would also be nice to able to send typeable text to the console. is this doable? could someone point me in the direction i should be heading? here is how my program starts currently

DWORD WINAPI ThreadProc(LPVOID lpParameter)

    HMODULE hInstance = GetModuleHandle( (char *)lpParameter);
    _tWinMain(hInstance,NULL,(char *)lpParameter,SW_SHOW);
    return 0;

int main(int argc, char* argv[])
    DWORD dwThreadID = 0;
    HANDLE hThread =  CreateThread(NULL,0,ThreadProc,argv[0],0,&dwThreadID);

SetConsoleTitle( "Console Window" );
SetConsoleTextAttribute(GetStdHandle( STD_OUTPUT_HANDLE ),FOREGROUND_GREEN);

//program goes here

return 0;

The message loop ect is in a different source file


Edited by lexusdominus: syntax

7 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.