Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29261 ディスカッション

trap ctrl-S in a Quickwin application ?

kyry
ビギナー
1,350件の閲覧回数
I have the following procedure (from Mr. Lawrence's book) to asign some hotkey's to the menu in my Quickwin application (listed below). I would like to trap the (frequently used) Ctrl-S combo for saving a file and assign it to my Save_Generated subroutine instead of the Shift-S combo I am using now. Any ideas ? Thank you for your help.

kyry

!****************
! the call to PASSDIRKEYSQQ

iret = PASSDIRKEYSQQ (PASS_DIR_CNTRLC)

! assign the keys

key = GETCHARQQ()
select case(ichar(key))
case(3) ! Ctrl-C
call Sensit_Check
case(13) ! Ctrl-M
call Layer_Info_Input
case(15) ! Ctrl-O
call Load_Parameters
case(83) ! Shift-S
call Save_Generated
case (24) ! Ctrl-X
call UserExit
end select
!******************
0 件の賞賛
5 返答(返信)
anthonyrichards
新規コントリビューター III
1,350件の閲覧回数
If you go to CVF help index and enter 'ASCII', under 'ASCII chart 1' you will find the code for CTRL+S = 19. This just reflects the position of 'S' in the alphabet. CTRL+A=1, CTRL+Z=26.
kyry
ビギナー
1,350件の閲覧回数
oh, I know the ASCII code for Ctrl-S (I should have said that in my message). It's just that even if I implement it in the code u see, is not working ... pressing Ctrl-S does nothing!
benh
ビギナー
1,350件の閲覧回数
You need to add this code to the list of acceleration keys. Somewhere (don't exactly remember where) I guess there should be a list of key codes that are associated with the corresponding command IDs from the menu resource.

-+-Ben-+-
kyry
ビギナー
1,350件の閲覧回数
that solution works if I define my own menu ... I am using the Quickwin interface and I don't need the accelerator table to be loaded
NotThatItMatters
ビギナー
1,350件の閲覧回数

Catching the keyboard accelerator table would seem to be the answer. However, if you go to the Windows API, you might notice the keyboard accelerator example already has the handle to the existing accelerator table. I have searched through the Windows API for a call which might give me the handle, but no luck. I suppose the closest I came was FindResource, but without knowing the names or IDs, that would be shooting in the dark.

slippery

返信