Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 7 Jahren, 9 Monaten
Letzter Beitrag:
vor 7 Jahren, 9 Monaten
Beteiligte Autoren:
Gus, steve erts, Al, DarrenF, Stefan Bentvelsen

How to send Ctrl+C

Startbeitrag von Gus am 18.10.2010 04:14

Hi:

In my application, I'm controlling other program, sending commands (strings). Eventually, I would need to send a Break command to interrupt a process in this program. Using Ctrl+C from the command Line, it works fine.
So, my question is how to send this Ctrl+C key code from WinDev?

Regards;
Gus

Antworten:

Hi Gus,

you can use SendKey() for that.

von Stefan Bentvelsen - am 18.10.2010 06:52
Hi Stefan:

Yes, but what is the ASCII code for the Control+C?

Thanks;
Gus

von Gus - am 18.10.2010 15:12
Hi Gus,

Is it decimal 3 / hex 03?


null ctrl-@ 0 00
start of heading ctrl-A 1 01 SOH 33 21 ! 65 41 A 97 61 a
start of text ctrl-B 2 02 STX 34 22 " 66 42 B 98 62 b
end of text ctrl-C 3 03 ETX 35 23 # 67 43 C 99 63 c
end of xmit ctrl-D 4 04 EOT 36 24 $ 68 44 D 100 64 d
enquiry ctrl-E 5 05 ENQ 37 25 % 69 45 E 101 65 e
acknowledge ctrl-F 6 06 ACK 38 26 & 70 46 F 102 66 f
bell ctrl-G 7 07 BEL 39 27 ' 71 47 G 103 67 g
etc...
.
.
.


von DarrenF - am 18.10.2010 15:48
Hi Darren:

Yes, but this was the first thing I tried and it didn't work.
I'm not sure if when the user press Control+C , the application receives just one keycode (0x03) or the keycodes for two keys (Control) and ( C ).

May be, I will need to write a C program and print the key value received from the OS when the user presses a key...

Thanls
Gus

von Gus - am 18.10.2010 17:36
Hello Gus

I haven't tried it, but according to the help for SendKey() it should be something like :

SendKey("^C") or SendKey("^c")

It is interesting that in the example:
// Expand the "&File" menu of a main window
SendKey("%&f")

They send a lower case f not F

To specify a key combination with SHIFT, CTRL or ALT, the standard code of the key must be preceded by one or more codes chosen among the following ones:
Key
Code
SHIFT
+
CTRL
^
ALT
%

Knowing PCSoft it will be possible with sendkey() but the syntax will not be immediately obvious.

Regards
Al

von Al - am 18.10.2010 19:02
this should do it.


SendKey("^&c")

The specific keys are listed in the "sendkey" help section (at least in WD 15 help)


von steve erts - am 18.10.2010 19:02
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.