×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

cycling child windows with tab and defining the enter action C++

cycling child windows with tab and defining the enter action C++

cycling child windows with tab and defining the enter action C++

(OP)
I was trying to do this a long time, but with no success.
my code:

CODE

#include <windows.h>

using namespace std;

char* ClassName = "mywindowclass";

HWND hMain = NULL;

HWND hChild1 = NULL;
HWND hChild2= NULL;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_CLOSE:
             DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
             PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
        break;
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    MSG Msg;

    //create and register window class
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = ClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
    
    RegisterClassEx(&wc);

    //create main window
    hMain = CreateWindowEx(
        WS_EX_CONTROLPARENT,      //extended style
        ClassName,            //window class
        "The Main Window",        //name
        WS_OVERLAPPEDWINDOW,      //style
        CW_USEDEFAULT, CW_USEDEFAULT, 300, 300,
        NULL,          //parent window
        NULL,          //menu
        hInstance,     //program instance
        NULL
        );
    
    ShowWindow(hMain, nCmdShow);
    UpdateWindow(hMain);

    //CHILD WINDOWS
             hChild1=CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
             WS_VISIBLE|WS_CHILD|WS_TABSTOP,
             10,10,40,20,hMain,(HMENU)7001,hInstance,NULL);
             
             hChild2=CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","",
             WS_VISIBLE|WS_CHILD|WS_TABSTOP,
             60,10,40,20,hMain,(HMENU)7002,hInstance,NULL);
    //END OF CHILD WINDOWS
      
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}

When I press the tab key while typing in the edit window, there is a beep.
I would also like to know how to define what happens if I am typing in the edit window and hitting the enter button.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close