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

Thanks!

Recommended Answers

All 2 Replies

Here are a couple suggestions that may or may not work for you.

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.