Is it possible to change TC DIR from a D5 App? YES [solved]

English support forum

Moderators: white, Hacker, petermad, Stefan2

eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Is it possible to change TC DIR from a D5 App? YES [solved]

Post by *eitang »

Hi all,

The title says it all...

I wrote a small D5 program [TC_BUT_EXE.EXE] to find (and optionally run) programs that exist in any of the "Defaultxy.bar" s. ( It is published here since several months ago).

I found that sometimes I only need TC to have the EXE's dir in one of its panes. All I came up with until now is that my program puts the path in the clipboard, and I paste it into TC...

Is there a way to sent TC a message to change a pane to a specific folder ???

TIA,
Last edited by eitang on 2009-12-16, 11:00 UTC, edited 1 time in total.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AFAIK, there is no messages available with text parameters, only commands w/o params.

You may execute TOTALCMD.exe with parameters /O /S /L=<path> or send to TC's command line messages WM_SETTEXT with command cd <path> and WM_KEYDOWN with key VK_RETURN (this way will kill previous state of command line, so you need to backup it before).
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Wow, nice TC feature, I'd missed it! BTW, if user has some instances of TC launched, theese functions may send command to wrong window... Also, I think that MAX_PATH chars may be not enough to fit two paths, especially if them are long.
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

Thank you for your help.

I have no cpp compiler, and do not understand the code. I also could not find a compiled version...

Any ideas?

TIA,
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
franck8244
Power Member
Power Member
Posts: 703
Joined: 2003-03-06, 17:37 UTC
Location: Geneva...

Post by *franck8244 »

2Eitang,

You can convert the code in delphi and include it in your own program (with a note)...
TC#88260 -
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

eitang, I will describe for you how it works:

1. define array of char and write to it following sequence of items:
> path to left dir
> (optional) #10 char and path to right dir
> (optional) #0 char and flags ('T', 'S' or 'ST')
e.g. you may write following chars to buffer: 'c', ':', '\', #10, 'd', ':', '\', #0, 'T' (9 chars total) - this will open C:\ and D:\ dirs in left and right panels in new tabs.

2. define struct COPYDATASTRUCT (perhaps in Delphi it will have name TCOPYDATASTRUCT) and set it fields to:
> dwData to ord('C') + 256 * ord('D')
> cbData to ammount of bytes used in defined buffer for all written information
> lpData to pointer to first char of buffer

3. use Windows function SendMessage with following parameters:
> handle of TC window
> WM_COPYDATA message
> 0
> pointer to defined TCOPYDATASTRUCT
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

MVV,

Thank you so much for the effort!!! I will try to understand the C++ and you advice asap.

franck8244,

Great idea! thank you.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

OK, your help did help! A question

Post by *eitang »

Mvv,

The program works perfectly now, but I had to guess some of the characters and part of the structure of the command line.

First of all Franck8244 helped me a lot by "translating" the C++ code into Delphi <g> [Many many thanks, Franck !] and then I had to guess some parameters that did not originally work...

Where can I find the official definition of this method of passing commands to TC from an external application?

I read (of course) the Help, but there you need to add command line delimiters (/) whereas in the PChar you do not. How did you know???

TIA,
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I don't know where to find but history.txt contains some info:
17.09.06 Added: Send WM_COPYDATA with dwData='E'+256*'M' and lpData pointing to em_xyz internal command (0-terminated) to execute that command. Accepts parameters separated by a space

12.04.06 Added: Support for environment variables in paths received via WM_COPYDATA from other programs
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

MVV,

>> ... history.txt ...

LOL.

Thank you very much.

This is not much of a documentation for such a capable openness of TC.

If our dear Christian did the job of adding these capacities to TC he had a reason, and probably wanted other programmers to be able to communicate with TC, so he must have documented it somewhere, I presume.

Maybe he will jump in here with some useful information.

I will scrutinize the history.txt , in the meanwhile <g>

Thanks a lot.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

A Little later:

I found a full description of the SEND and RECEIVE function around WM_CopyData:

http://delphi.about.com/od/windowsshellapi/a/wm_copydata.htm

... If you're interested.

Thanks.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

eitang wrote:I found a full description of the SEND and RECEIVE function around WM_CopyData:

http://delphi.about.com/od/windowsshellapi/a/wm_copydata.htm

... If you're interested.
I don't like Delphi (I hate VCL mainly; but I know how to operate with Windows API in it). I'm a C/C++ programmer, so my help on this API message first of all is here: http://msdn.microsoft.com/en-us/library/ms649011%28VS.85%29.aspx (of course, I have offline MSDN also and prefer it) :)
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

MVV,

>> I don't like Delphi (I hate VCL mainly

<LOL>

I used to (since 1981) program under CP/M and later MS DOS with compilable interpreters like dBase and Basic.

After awhile I "met" Turbo Pascal and really fell in love with this language. (50K the whole package !!!).

When "C" arrived, I did not give it any attention and, naturally, with Windows I switched to Delphi. So with D I stay <g>
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Does anybody know how to pass path in Unicode using WM_COPYDATA function? I tried to use Unicode BOM and UTF-8 BOM, but it doesn't work for me. :?:

Also when I send message (I'm using "S" flag) and right panel is active, TC changes path but makes active left panel... Is there a way to avoid such behaviour? :?:


OK, UTF-8 BOM with UTF-8 text works. But second question remains...
Post Reply