WS_TABSTOP

场景:WS_TABSTOP没法切换焦点

WS_TABSTOP无法切换焦点?
小弟我最近一个程序临时需要用到windows api去创建界面,不是MFC噢,但我对windows编程不熟悉。我在用createwindow创建主窗体后WindowProc函数中会响应WM_CREATE,然后在这里面用
C/C++ code
CreateWindow(
        L"EDIT",
        NULL,
        WS_CHILD | WS_VISIBLE| WS_BORDER | WS_TABSTOP | WS_GROUP/*| ES_PASSWORD*/ ,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        hwndP,
        menu,
        hinst,
        0);

函数创建了几个编辑框,但是我使用TAB键无法切换焦点,我不知道为什么,请哪位帮帮忙说下

代码如下:
C/C++ code
Newgui::Newgui(HINSTANCE hInstance, int nCmdShow,int argc, char **argv)
{
    newgui_argc = argc;
    newgui_argv = argv;

    WNDCLASSEX WindowClass;
    static LPCTSTR szAppname = L"window";
    MSG msg;

    WindowClass.cbSize = sizeof(WNDCLASSEX);
    WindowClass.style = CS_HREDRAW | CS_VREDRAW | WS_TABSTOP;
    WindowClass.lpfnWndProc = WindowProc;
    WindowClass.cbClsExtra = 0;
    WindowClass.cbWndExtra = 0;
    WindowClass.hInstance = hInstance;
    WindowClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(RED_ICON_RES_ID));
    WindowClass.hCursor = LoadCursor(0, IDC_ARROW);
    WindowClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1) ;
    WindowClass.lpszMenuName = 0;
    WindowClass.lpszClassName = szAppname;
    WindowClass.hIconSm = 0;

    RegisterClassEx(&WindowClass);
    hWnd = CreateWindow(
        szAppname,
        L"Client",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        350,  //宽
        240,   //高
        0,
        0,
        hInstance,
        0);
        
    ShowWindow(hWnd, SW_SHOWNORMAL);
    UpdateWindow(hWnd);

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

}

LRESULT WINAPI Newgui::WindowProc(HWND hWnd, UINT message,WPARAM wParam ,LPARAM lParam)
{
    HDC hDC;
    PAINTSTRUCT PaintSt;
    RECT aRect;

    HINSTANCE hInstance = NULL;

    HWND hostEdit = NULL, hostLabel = NULL,pwdEdit = NULL, 
                 pwdLabel = NULL, portLabel = NULL, portEdit = NULL;

    HWND connectBtn = NULL , helpBtn = NULL;

    TCHAR HostInput[MAX_CHAR1];
    TCHAR PwdInput[MAX_CHAR2];
    TCHAR PortInput[PORTSZ];

    int i = 0, j = 0, k = 0;
    
    SendDlgItemMessage(hWnd, IDC_HOST, EM_SETLIMITTEXT,(WPARAM)15, (LPARAM)0);
    SendDlgItemMessage(hWnd, IDC_PWD, EM_SETLIMITTEXT, (WPARAM)18, (LPARAM)0);

    switch(message)
    {

        case WM_CREATE:
        
            hostEdit = CreateEdit(hWnd, hInstance, (HMENU)IDC_HOST);
            SetWindowPos(hostEdit, HWND_TOP, 120, 40, 180, 20, SWP_SHOWWINDOW);

                pwdEdit = CreatePwdEdit(hWnd , hInstance, (HMENU)IDC_PWD);
            SetWindowPos(pwdEdit, HWND_TOP, 120, 70, 180, 20, SWP_SHOWWINDOW);

            hostLabel = CreateLabel(hWnd, hInstance, L"主机:");
            SendMessage(hostLabel, WM_SETFONT, (WPARAM)hf, TRUE); 
            SetWindowPos(hostLabel, HWND_TOP, 20, 40, 80, 20, SWP_SHOWWINDOW);

            pwdLabel = CreateLabel(hWnd, hInstance, L"密码:");
            SendMessage(pwdLabel, WM_SETFONT, (WPARAM)hf, TRUE); 
            SetWindowPos(pwdLabel, HWND_TOP, 20, 70, 80, 20, SWP_SHOWWINDOW);

            portLabel = CreateLabel(hWnd, hInstance, L"端口:");
            SendMessage(portLabel, WM_SETFONT, (WPARAM)hf, TRUE); 
            SetWindowPos(portLabel, HWND_TOP, 20, 100, 80, 20, SWP_SHOWWINDOW);

            portEdit = CreateEdit(hWnd, hInstance, (HMENU)IDC_PORT);
            SetWindowPos(portEdit, HWND_TOP, 120, 100, 180, 20, SWP_SHOWWINDOW);

            connectBtn = CreateButton(hWnd, hInstance, L"连接", (HMENU)IDB_CONNECT);
            SendMessage(connectBtn, WM_SETFONT, (WPARAM)hf, TRUE); 
            SetWindowPos(connectBtn, HWND_TOP, 250, 150, 50, 20, SWP_SHOWWINDOW);

            helpBtn = CreateButton(hWnd, hInstance, L"帮助",(HMENU)IDB_HELP);
            SendMessage(helpBtn, WM_SETFONT, (WPARAM)hf, TRUE); 
            SetWindowPos(helpBtn, HWND_TOP, 180, 150, 50, 20, SWP_SHOWWINDOW);    

             case WM_ACTIVATE:                // 当窗口被激活时,将焦点设置在文本框上
                 ::SetFocus(hostEdit);        //这个会起作用
    
                 case WM_DESTROY:

            PostQuitMessage(0);
         return 0;

            default:

            return DefWindowProc(hWnd, message, wParam, lParam);
    }

贴上了部分代码,求解,不胜感激

------解决方案--------------------
C/C++ code
HWND hEdit = NULL;
    while (GetMessage(&msg, NULL, 0, 0)) 
    {
        hEdit = msg.hwnd;
        if((NULL != hEdit) && (WM_KEYDOWN == msg.message) && (VK_TAB == msg.wParam))
        {
            TCHAR szClass[MAX_PATH] = {0};
            GetClassName(hEdit, szClass, sizeof(szClass)/sizeof(szClass[0]));
            if(0 == _tcscmp(szClass, _T("Edit")))
            {
                HWND hWnd = GetNextDlgTabItem(GetParent(hEdit), hEdit, FALSE);
                SetFocus(hWnd);
            }
        }
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }