Hello,

I'm handling the messages of a window inside my class, but I would like that the program runs further without interference of the message handler. So I'm trying to do it like this

Code:
void CDialog::MessageHandler(HWND hwnd)
{
	if(!AttachThreadInput(GetCurrentThreadId(),GetWindowThreadProcessId(hwnd, NULL),TRUE))
		MessageBox(0,TEXT("Error"),TEXT("Error"),0);

	MSG msg;

	while(GetMessage( &msg, hwnd, 0, 0 ))
	{ 
		TranslateMessage(&msg); 
		DispatchMessage(&msg); 
	} 
}

void CDialog::StartWindow()
{
	CreateThread(0,0,(LPTHREAD_START_ROUTINE)MessageHandler,hWnd,0,0);
}
But since GetMessage() only seems to get messages inside the same thread it does not work, even with Attach to the thread not. Is it also needed to make a new thread for every window? Seems the best way for me.

Thanks,

NLscotty