PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rudolf Furstauer on September 05, 2012, 02:21:23 PM

Title: %WM_KEYDOWN/%VK_ESCAPE
Post by: Rudolf Furstauer on September 05, 2012, 02:21:23 PM
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
Title: Re: %WM_KEYDOWN/%VK_ESCAPE
Post by: Paul Squires on September 06, 2012, 08:39:51 AM
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.
Title: Re: %WM_KEYDOWN/%VK_ESCAPE
Post by: Rudolf Furstauer on September 06, 2012, 10:14:17 AM
Yes, there are some controls that I can use for it.
Thanks for the help.