• Welcome to PlanetSquires Forums.
 

%WM_KEYDOWN/%VK_ESCAPE

Started by Rudolf Furstauer, September 05, 2012, 01:51:23 PM

Previous topic - Next topic

Rudolf Furstauer

Why I do not get into 'FUNCTION FORM1_CUSTOM' the message '%WM_KEYDOWN'.

'--------------------------------------------------------------------------------
FUNCTION FORM1_CUSTOM ( _
                      hWndForm      AS DWORD, _  ' handle of Form
                      wMsg          AS LONG,  _  ' type of message
                      wParam        AS DWORD, _  ' first message parameter
                      lParam        AS LONG   _  ' second message parameter
                      ) AS LONG

    'Message
    '--------------------------------------------
    SELECT CASE wMsg

        '--------------------------------------------
        CASE %WM_KEYDOWN
            IF wParam = %VK_ESCAPE THEN MsgBox "%WM_KEYDOWN/%VK_ESCAPE"

        '--------------------------------------------
        CASE %WM_RBUTTONDOWN
            MsgBox "%WM_RBUTTONDOWN"

        '--------------------------------------------
        CASE %WM_LBUTTONDOWN
            MsgBox "%WM_LBUTTONDOWN"

        '--------------------------------------------
        CASE %WM_CLOSE
            MsgBox "%WM_CLOSE"

    END SELECT

END FUNCTION

The other messages arrive correctly.

Am I doing something wrong?
In a project with PB10 it works.

Rudolf Fuerstauer

Paul Squires

A Form by itself will not receive keystrokes. I believe this has been discussed in these forums a long time ago. If there are no other controls on the Form then the hack would be to create a command button and set its Visible property to False. You would then test for keystrokes on the command button rather than the Form.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Rudolf Furstauer

Yes, there are some controls that I can use for it.
Thanks for the help.