I have subclassed an Edit control for the purpose of detecting the enter key being pressed then calling a function accordingly. All that part seems to work just fine so far. The problem I am having is that I then want the Edit control to not move to the next line. I have tried simply returning 0 after calling my procedure that should trigger on each press of the enter key, but this does not seem to prevent the Edit box from moving down to the next line.

This is what I have thus far:
Code:
// ...
HWND g_hEdit;
WNDPROC g_EditProc;
// ...

// Subclassed edit window procedure.
LRESULT WINAPI EditProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Check for Enter key to start sending chunks.
switch (msg)
{
    case WM_KEYDOWN:
	switch (LOWORD(wParam))
	{
	    case VK_RETURN:
		SendChat();
		break; // tried replacing with 'return 0;' and it did not have the desired effect.
	}
	break;
    case WM_CLOSE:
	SetWindowLong(g_hEdit, GWL_WNDPROC, (DWORD)g_EditProc);
	break;
    case WM_DESTROY:
	SetWindowLong(g_hEdit, GWL_WNDPROC, (DWORD)g_EditProc);
	break;
}
return CallWindowProc(g_EditProc, hWnd, msg, wParam, lParam);
}

// Main window procedure.
LRESULT CALLBACK MainWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT rcMain;

switch (msg)
{
    // Build child windows.
    case WM_CREATE:
	g_hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
	WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,
	0, 0, 290, 170, hWnd, NULL, GetModuleHandle(NULL), NULL);
	g_EditProc = (WNDPROC)SetWindowLong(g_hEdit, GWL_WNDPROC, (DWORD)EditProc);
	break;
// ...
I have searched online and found some examples on how to disable Ctrl+V and Ctrl+Alt+Del and the like. These seem to be a bit advanced and outside the scope of something that to me must be much simpler. I also found examples on how to prevent normal roman characters and numbers from being sent, they suggested using return 0. This solution doesn't seem to work in regards to Enter though.