and I want to translate code to send user commands in TC to Delphi, I did
it like you all see below but it does not work ;/ What I do wrong? I'm only
have Delphi knowledge not C languages. TC is ofcourse running but even
if I change Application.Handle to 0 or CmdArray to PChar(Command) in a
lpData parameter is it still do not work. Nothing happend. Please helpe me
solve this problem. Thanks in advice and sorry for my bad english. My code:
Code: Select all
procedure SendTCUserCommand(Command : string);
var
I : integer;
Tc_H : HWND;
CmdArray : array of Char;
DataStruct : CopyDataStruct;
begin
TC_H := FindWindow('TTOTAL_CMD', nil);
if (TC_H <> 0) and (Command <> '') then
begin
SetLength(CmdArray, Length(Command));
for I := 0 to Length(Command) - 1 do
begin
CmdArray[I] := Command[I];
end;
DataStruct.dwData := Ord('E') + 256 * Ord('M');
DataStruct.cbData := Length(Command) + 1;
DataStruct.lpData := CmdArray; ;
SendMessage(TC_H, WM_COPYDATA, Application.Handle, Integer(@DataStruct));
end;
end;
Code: Select all
SendTCUserCommand('cm_FtpNew');
wand use OPENTABS command so I need parameters (*.tab path + filename).
Code: Select all
procedure SendTCCommandLikeAhk(CommandID : integer);
var
Tc_H : HWND;
begin
TC_H := FindWindow('TTOTAL_CMD', nil);
if (TC_H <> 0) and (CommandID > 0) then
begin
SendMessage(TC_H, 1075, CommandID, 0);
end;
end;