Recent

Author Topic: TProcess.CommandLine and virtual key combinations  (Read 4403 times)

gambothell

  • New Member
  • *
  • Posts: 27
TProcess.CommandLine and virtual key combinations
« on: November 17, 2009, 12:18:23 am »
When using the TProcess to run an application under your compiled program, I need to issue a virtual keystroke combination.

How do you enter a key combination for the command line that requires shift and ctrl keys, example: shift+ctrl+Q

AProcess.CommandLine := [VK_SHIFT]+[VK_CTRL]+'Q';  does not work
AProcess.Execute;

Thanks for your assistance.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: TProcess.CommandLine and virtual key combinations
« Reply #1 on: November 17, 2009, 09:55:01 am »
Use AProcess.Input.Write() method. I don't really know how a key combination is handled, but I guess it's worth to try:
Code: [Select]
var
  s: String;
begin
  s:=Chr(VK_SHIFT)+Chr(VK_CTRL)+'Q';
  AProcess.Input.Write(s[1],Length(s));
end;
Call it after execute. Precisely, after the program blocks for input.

 

TinyPortal © 2005-2018