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

trap ctrl-S in a Quickwin application ?

kyry
Beginner
1,348 Views
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 Kudos
5 Replies
anthonyrichards
New Contributor III
1,348 Views
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.
0 Kudos
kyry
Beginner
1,348 Views
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!
0 Kudos
benh
Beginner
1,348 Views
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-+-
0 Kudos
kyry
Beginner
1,348 Views
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
0 Kudos
NotThatItMatters
Beginner
1,348 Views

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

0 Kudos
Reply