After server hours, I found a way to do it.

Code:
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
		if (Msg.message == WM_KEYDOWN && Msg.wParam == VK_RETURN)
		{
			if (GetFocus() == hEdit1)
				MessageBox(hwnd, "It worked", It worked", MB_OK);
		}
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;