detect key strokes in WindowProc function? - Programmer

This is a discussion on detect key strokes in WindowProc function? - Programmer ; Hi all, I was wondering if there was any way to detect key strokes in the WindowProc(UINT message, WPARAM wParam, LPARAM lParam) of my dialog class? I know it can be done in the pre-translate method, but for a specific ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: detect key strokes in WindowProc function?

  1. detect key strokes in WindowProc function?

    Hi all,

    I was wondering if there was any way to detect key strokes in the
    WindowProc(UINT message, WPARAM wParam, LPARAM lParam) of my dialog
    class?

    I know it can be done in the pre-translate method, but for a specific
    reason, I want to do it in the windowProc.

    I've tried the following things and they dont work. i.e the WM_KEYUP or
    WM_KEYDOWN or WM_CHAR are never sent to this function.

    LRESULT CBasePage::WindowProc(UINT message, WPARAM wParam, LPARAM
    lParam)
    {
    if( message == WM_KEYUP )
    {
    //do something here
    }
    else if (message == WM_CHAR)
    {
    //do something here also
    }
    return CDialog::WindowProc(message,wParam,lParam);
    }

    Any help on this matter would really be apreciated.
    Thanks
    Arfeen


  2. Re: detect key strokes in WindowProc function?

    arfeengodil@gmail.com wrote:
    > Hi all,
    >
    > I was wondering if there was any way to detect key strokes in the
    > WindowProc(UINT message, WPARAM wParam, LPARAM lParam) of my dialog
    > class?
    >
    > I know it can be done in the pre-translate method, but for a specific
    > reason, I want to do it in the windowProc.
    >
    > I've tried the following things and they dont work. i.e the WM_KEYUP or
    > WM_KEYDOWN or WM_CHAR are never sent to this function.
    >
    > LRESULT CBasePage::WindowProc(UINT message, WPARAM wParam, LPARAM
    > lParam)
    > {
    > if( message == WM_KEYUP )
    > {
    > //do something here
    > }
    > else if (message == WM_CHAR)
    > {
    > //do something here also
    > }
    > return CDialog::WindowProc(message,wParam,lParam);
    > }
    >
    > Any help on this matter would really be apreciated.
    > Thanks
    > Arfeen
    >

    WM_KEYDOWN and WM_KEYUP messages ARE sent to the window that has the
    focus when the key is pressed or released.

    WM_CHAR messages ARE sent to the window that has the focus if you pass
    the WM_KEYDOWN and WM_KEYUP messages into TranslateMessage().

    You obviously have something wrong but it's impossible to tell exactly
    what it is from the information that you have posted.

    Norm

    --
    --
    To reply, change domain to an adult feline.


+ Reply to Thread