Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28923 Discussions

Help to catch Arrow key event under Windows 10

cean
New Contributor II
857 Views

Hi,

I am using OneAPI Fortran 2023.2.0 to write a Win32 program on Windows 10. Where could I catch the Arrow key event? I can catch normal keys under WM_KEYDOWN. But the code below doesn't work for Virtual Key like the Arrow Keys. 

Thanks for help.

Cheers,

Cean

integer function WndProc( hwnd, message, wParam, lParam )
    select case (message)
        case (WM_KEYDOWN) 
            wParam = and(wParam, #0000ffff)
	        select case (wParam) 
            case (VK_LEFT)
				!// Process the LEFT ARROW key. 
				ret = MessageBox (hwnd, "Left arrow is pressed"C, "Hi"C, MB_OK)
				return

			case (VK_RIGHT) 

 

0 Kudos
1 Solution
cean
New Contributor II
832 Views

Thanks. I should not call the TranslateMessage function.

View solution in original post

0 Kudos
2 Replies
andrew_4619
Honored Contributor III
837 Views

Do you have any PeekMessage calls within you message processing that are intercepting these keystokes maybe?

Also if the cursor is in certain windows e.g. in a text box the arrowed keys get intercepted by windows for the carot position movement maybe that is a problem.

cean
New Contributor II
833 Views

Thanks. I should not call the TranslateMessage function.

0 Kudos
Reply