CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Problem with the handling of ESC key in textbox control

  1. #1
    Join Date
    Mar 2004

    Problem with the handling of ESC key in textbox control


    I am facing a problem with the handling of ESC key in user controls
    created in VB.

    I have a multiline text box in the control. Also the text box is enabled
    since I have to select/copy text in it.

    Next I place the control in an MFC dialog. I do not need OK and Cancel
    buttons on it and so I remove them and the corresponding handlers. Now,
    when I click in the text box and then press ESC key, the text box
    disappears and the application crashed.

    Strangely, when I used the control in a VB form this problem was not

    I am using VB 6.0 and VC++ 6.0.

    If any can let me know how this may be resolved with VC++, it is greatly

    Thanks in Advance

  2. #2
    Join Date
    Mar 2004
    VB doesn't create proper system DLL's like C++ does and they can only be used in the VB environment. If you wnat to use a control in both environments then you will need to create it in VC++.


  3. #3
    Join Date
    Dec 2001
    I wonder if setting the KeyPreview property of the control to True will let you catch the escape key and prevent the problem. My guess is that it won't. However, suppose you change the window style of the dialog to eliminate the "X" button? Won't it then not respond to the escape key?
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)