How to use the F10 key?

How to use the F10 key?

Portrait de dboggs

I have a group of programs written in DOS F77 that allowed the user to respond to various prompts, menus, etc. using a variety of keys, including F1 - F10. These programs must be upgraded. Trapping the extended key scan codes for the function keys is easy, so in general this is no problem, But, the F10 key is special. My program sees F10 and continues accordingly, but Windows also traps it and attempts to open the File object on the window's menu. Then, further input of keys is blocked until the user completes the menu action--something which of course he doesn't want to do.

A simple <escape> keypress would close the menu and allow the program to continue. But the client WANTS to use the F10 key and he doesn't WANT to follow with <esc> every time. I thought it should be easy to have my program simulate the <esc> keypress, but I can't get anything to work. I have tried using functions like:

     I4 = SYSTEM (CHAR(27))

     I4 = SYSTEMQQ (CHAR(27)

These work sometimes, but not consistently. Then I tried

    I4 = SYSTEM (SendEscape.vbs) where SendEscape.wsh is a singel-line script file "wsecho chr(27)".

This seems to work, but unfortunately the screen flashes briefly while the script runs. Would be nice to turn this off, but I don't know how.

Any ideas?

8 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Paul Curtis

F10 and similar keys can be trapped by inserting a hook process; I have posted sample code for this before.

Portrait de gvautier

Hello

Do you upgrade your programs to console or windowed applications?

Portrait de dboggs

Not sure what the relevancy of your inquiry is, but for what it's worth I am upgrading old F77 programs to Quickwin applications. I think the issue with the F10 key is independent of the type. If it's not I would like to know some details.

Portrait de gvautier
Portrait de gvautier

Have you tested the passdirkeysqq function ?

Portrait de dboggs

Yes, I am using passdirkeysqq. Does F10 trapping work for you?

Also: the shift-tab key does not work--it is intercepted by Windows, just like F10. It turns out that not being able to program a response to shift-tab causes even more grief than F10.

Portrait de gvautier

I uesed Quickwin long time ago and I don't remember if I had problems with f10 key. With a classic windowed application, I intercept the  WM_SYSCOMMAND message with wparam=SC_KEYMENU and lparam=0 to intercept f10 key.

Connectez-vous pour laisser un commentaire.