Thanks for the reply. I already have that as the extended style:

Code:
HWND hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, 
				RICHEDIT_CLASS, 
				"", 
				WS_CHILD | WS_VISIBLE, 
				0, 0, 0, 0, 
				hWnd, 
				HMENU(IDC_COMMAND_EDIT_CTRL),
				GetModuleHandle(NULL), 
				NULL);
From everything I've read it seems that it's not the programmer's responsibility to redraw the border so i think I must have broken something in subclassing the edit control. Here's where that's done:

Code:
g_pOldCommandEditProc = WNDPROC(SetWindowLong(hEdit, GWL_WNDPROC, LONG(commandBoxSubClassProc)));
Here's the edit control window procedure, which is just there to capture the enter key being pressed:

Code:
LRESULT CALLBACK commandBoxSubClassProc(HWND hEditWnd, WORD mMsg, WORD wParam, LONG lParam)
{
    switch (mMsg)
    {
	case WM_GETDLGCODE : return long((DLGC_WANTALLKEYS | CallWindowProc(g_pOldCommandEditProc, hEditWnd, mMsg, wParam, lParam)));
		 	 break;
 
	case WM_CHAR       : if (wParam == VK_RETURN)
				return 0;
			 return long(CallWindowProc(g_pOldCommandEditProc, hEditWnd, mMsg, wParam, lParam));
			 break;

	case WM_KEYDOWN	   : return g_cwChildWindows.getCommandBoxPt()->processCommandKeys(hEditWnd, mMsg, wParam, lParam);
			 break;

	default		   : return CallWindowProc(g_pOldCommandEditProc, hEditWnd, mMsg, wParam, lParam);
			 break;
	}
}
I'm the first to admit I don't know what I'm doing but that all seems fine to me.

The other thing it might be is the message loop for the main window:

Code:
while (GetMessage(&mMsg, NULL, 0, 0))
I'm using NULL for the handle of the window, which gets the messages for all windows so I think the messages for the subclassed edit control might be going to the main window and that's why the border isn't redrawing. However, other messages for the edit control seem to work okay.

Changing the NULL to the main window handle stops the program exiting properly (the main window disappears but the program is still running and using 99% of the processor time) and changing it doesn't fix the border redraw problem anyway.

I can't find what the problem is.