inputWindow = CreateWindow( "EDIT", 0, ES_LEFT|ES_AUTOHSCROLL|WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, 0, 0, 10, 10, hwnd, 0, appInstance, 0 );
inputWindow = CreateWindow( "EDIT", 0, ES_LEFT|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_NOHIDESEL|WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, 0, 0, 10, 10, hwnd, 0, appInstance, 0 );
LRESULT CALLBACK wpWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ){	CHARFORMAT cf;	LOGFONT lfont;	switch( msg )	{	case WM_CREATE:		// Create Richedit Box		logWindow = CreateWindow( RICHEDIT_CLASS, 0, ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL|ES_READONLY|WS_CHILD|WS_VISIBLE|WS_VSCROLL, 0, 0, 10, 10, hwnd, (HMENU)CONTROL_LOGWINDOW, appInstance, 0 );		if( logWindow == 0 )		{			MessageBox( 0, QString( "Couldn't create the logwindow: " + getErrorString() ).latin1(), "Wolfpack", MB_OK|MB_ICONERROR );			DestroyWindow( hwnd );			return TRUE;		}		// Set up the fonts we need        		ZeroMemory( &lfont, sizeof( LOGFONT ) );		qstrcpy( lfont.lfFaceName, "Courier" );		font = CreateFontIndirect( &lfont );           		// Set the font of our logwindow		SendMessage( logWindow, WM_SETFONT, (WPARAM)font, 0 );		SendMessage( logWindow, EM_SETBKGNDCOLOR, 0, (LPARAM)RGB(0,0,0) );		// Default Charformat        ZeroMemory( &cf, sizeof( CHARFORMAT ) );        cf.cbSize = sizeof( CHARFORMAT );        cf.dwMask = CFM_COLOR;        cf.crTextColor = RGB( 0xAF,0xAF,0xAF ); 		SendMessage( logWindow, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf );		SendMessage( logWindow, EM_AUTOURLDETECT, 1, 0 );		SendMessage( logWindow, EM_SETEVENTMASK, 0, ENM_LINK|ENM_MOUSEEVENTS|ENM_KEYEVENTS );		// Create InputWindow		inputWindow = CreateWindow( "EDIT", 0, ES_LEFT|ES_AUTOHSCROLL|WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, 0, 0, 10, 10, hwnd, 0, appInstance, 0 );		return 0;		// Autosize our Window Elements	case WM_SIZE:		if( logWindow && inputWindow && wparam != SIZE_MINIMIZED && wparam != SIZE_MAXHIDE )		{			unsigned int width = LOWORD( lparam );			unsigned int height = HIWORD( lparam );			// Measure the Height of our Input Field			if( !inputHeight )			{				HFONT font = (HFONT)SendMessage( mainWindow, WM_GETFONT, 0, 0 );				if( !font )					font = (HFONT)GetStockObject( SYSTEM_FONT );				LOGFONT logfont;				if( GetObject( font, sizeof( LOGFONT ), &logfont ) == sizeof( LOGFONT ) )					inputHeight = logfont.lfHeight + 4;			}			MoveWindow( logWindow, 0, 0, width, height - inputHeight, TRUE );			MoveWindow( inputWindow, 0, height - inputHeight, width, inputHeight, TRUE );		}		return 0;	case WM_ERASEBKGND:		return 1;	case WM_SETFOCUS:		SendMessage( inputWindow, WM_SETFOCUS, 0, 0 );		return 1;	case WM_NOTIFY:		if( wparam == CONTROL_LOGWINDOW )		{			NMHDR *notify = (NMHDR*)lparam;						if( notify->code == EN_LINK )			{				ENLINK *link = (ENLINK*)notify;				if( link->msg == WM_LBUTTONDOWN )				{					char *string = new char[ ( link->chrg.cpMax - link->chrg.cpMin ) + 1 ];										TEXTRANGE tr;					tr.chrg = link->chrg;					tr.lpstrText = string;					SendMessage( logWindow, EM_GETTEXTRANGE, 0, (LPARAM)&tr );					// String contains the link					delete [] string;					// Reset selection to the end				}							}		}			case WM_DESTROY:		keeprun = 0;		return 0;	default:		return DefWindowProc( hwnd, msg, wparam, lparam ); 	}}