Thread: Window problem

  1. #1
    Unregistered
    Guest

    Window problem

    I have an edit box/window and when I press enter/return, I want it to clear the edit box/window, kind of like a command prompt. I would appreciate any help.

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Look up the WM_SETTEXT message.

  3. #3
    Unregistered
    Guest
    No, clearing the edit box is'nt the problem. The problem is doing it when one presses enter/return.

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    look up the WM_KEYDOWN message
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  5. #5
    Unregistered
    Guest
    I already know about the WM_KEYDOWN message.

    How can inplement another message procedure for the edit box so that I can handle such messages as WM_KEYDOWN ?

    Thanks in advance.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    In your message switch, look for when enter is pressed. Then check which window has focus. If it is the edit, send a WM_SETEXT message with the info you want.

  7. #7
    Unregistered
    Guest
    Ok, but how do you check which Window has focus?

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    GetFocus() returns the handle of the window that has focus. I bet you could have guessed that this is the function that you would use

  9. #9
    Registered User
    Join Date
    Dec 2001
    Posts
    70
    WNDPROC OldEditProc;

    LRESULT CALLBACK MyEditProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {

    switch (message) {
    case WM_KEYDOWN:

    ....

    break;
    }

    return CallWindowProc (OldEditProc, hWnd, message, wParam, lParam);
    }


    You may process the keystrokes in your own wndproc, called here MyEditProc. The edit box must exist (hWndEdit is valid)
    to do the subclass.

    OldEditProc = (WNDPROC) SetWindowLong (hWndEdit, GWL_WNDPROC, (LONG) MyEditProc);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  2. input/output
    By dogbert234 in forum Windows Programming
    Replies: 11
    Last Post: 01-26-2005, 06:57 AM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. How to change window style at runtime?
    By Mr. Bitmap in forum Windows Programming
    Replies: 5
    Last Post: 06-09-2002, 04:49 PM