From: David De Bono on

"Karl E. Peterson" <karl(a)exmvps.org> skrev i nyhetsmeldingen:
i2d4ao$kfj$1(a)news.eternal-september.org ...
> David De Bono has brought this to us :
>>>> I found the solution using PeekMessageW
>>>
>>> Curious, care to share?
>>
>> Here:
>>
>> Public Declare Function PeekMessageW Lib "user32" (lpMsg As msg, ByVal
>> hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long,
>> ByVal wRemoveMsg As Long) As Long
>>
>> Public Const WM_KEYFIRST = &H100
>> Public Const WM_KEYLAST = &H108
>>
>> Public Type POINTAPI
>> x As Long
>> y As Long
>> End Type
>>
>> Public Type msg
>> hWnd As Long
>> Message As Long
>> wParam As Long
>> lParam As Long
>> time As Long
>> pt As POINTAPI
>> End Type
>>
>> Public Function GetLastKeyPressed() As Long
>>
>> Dim Message As msg
>>
>> If PeekMessageW(Message, 0, WM_KEYFIRST, WM_KEYLAST, 0) Then
>> GetLastKeyPressed = Message.wParam
>> Else
>> GetLastKeyPressed = -1
>> End If
>>
>> Exit Function
>>
>> End Function
>
> Called from *_KeyDown? Nice. It's only seeming to miss the navigation
> and state keys?
>
> --
> .NET: It's About Trust!
> http://vfred.mvps.org
>
>

Yes, called from KeyDown, and NOT keypressed. The navigation and statekeys
you will get from the KeyDown event anyway. So first check for navigation
and state keys in KeyDown again, and then call this routine.

David

From: Karl E. Peterson on
It happens that David De Bono formulated :
>
> "Karl E. Peterson" <karl(a)exmvps.org> skrev i nyhetsmeldingen:
> i2d4ao$kfj$1(a)news.eternal-september.org ...
>> David De Bono has brought this to us :
>>>>> I found the solution using PeekMessageW
>>>>
>>>> Curious, care to share?
>>>
>>> Here:
>>>
>>> Public Declare Function PeekMessageW Lib "user32" (lpMsg As msg, ByVal
>>> hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long,
>>> ByVal wRemoveMsg As Long) As Long
>>>
>>> Public Const WM_KEYFIRST = &H100
>>> Public Const WM_KEYLAST = &H108
>>>
>>> Public Type POINTAPI
>>> x As Long
>>> y As Long
>>> End Type
>>>
>>> Public Type msg
>>> hWnd As Long
>>> Message As Long
>>> wParam As Long
>>> lParam As Long
>>> time As Long
>>> pt As POINTAPI
>>> End Type
>>>
>>> Public Function GetLastKeyPressed() As Long
>>> Dim Message As msg
>>> If PeekMessageW(Message, 0, WM_KEYFIRST, WM_KEYLAST, 0) Then
>>> GetLastKeyPressed = Message.wParam
>>> Else
>>> GetLastKeyPressed = -1
>>> End If
>>> Exit Function
>>> End Function
>>
>> Called from *_KeyDown? Nice. It's only seeming to miss the navigation and
>> state keys?
>
> Yes, called from KeyDown, and NOT keypressed. The navigation and statekeys
> you will get from the KeyDown event anyway. So first check for navigation and
> state keys in KeyDown again, and then call this routine.

Makes sense. Good solution!

--
..NET: It's About Trust!
http://vfred.mvps.org