Folder tabs - get them into my delphi program ?

English support forum

Moderators: Hacker, petermad, Stefan2, white

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

Folder tabs - get them into my delphi program ?

Post by *eitang »

Hi all,

I have written a Delphi program - A TC AddOn - that does complex work (see below).

It already works fine, but I would like to be able to let it grab automatically the list of the currently displayed tabs in the "source" pane, when my program is installed in TC's button-bar.

I know, (and used in my CopyToTabs) about the %P%S %T%M parameters, but found nothing about recuperating TAB folders list.

Of course it would be possible to write a temporary *.TAB file, read it into my program and work out my folders list but this too cannot (as far as I know) be done from a Delphi program, or can it? (would solve my problem).

//************************************************

My program does the following:

I always back up files (my stuff, software, important docs etc.) to 4 external disks.

This involves modifying one of them (delete, folder-rename/redate, copy etc.) until it suits my needs. Let's call this HD HDA. Then I need to:

1 Delete all folders on the three other disks (=tabs) that have been modified on HDA

2 Copy all modified folders on HDA onto the other 3 disks.

Manually it is very time consuming, with my program I am immediately free to do something else.

The 3 destinations (or, of course, any number) are in three TABS because I open all four of them using a .TAB file. My manually modified one is the leftmost tab. Hence my need to read them into my program.

[ Currently I compute the destinations based on the source as the folders structures are identical, but this is not "elegant". ]

Thanks in advance,
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50923
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

There is no direct way to get the tabs. But the following would work:
1. Send cm_ConfigSaveSettings command
2. Read the inactive tabs from [lefttabs] and [righttabs] from wincmd.ini, the active tabs from [left] and [right]
Author of Total Commander
https://www.ghisler.com
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

Hi Christian,

Thanks for the quick reply !

>> There is no direct way to get the tabs. But the following
I thought so...

>> 1. Send cm_ConfigSaveSettings command
From my Delphi program ??? How ?

Is there a way to add such an internal command before my button gets executed ?

Thanks,
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

You have to send a WM_USER+51 window message with the cm code (580 in this case).
No idea how it works in Delphi but search the forum for "WM_USER" and you'll find this for example: Using SendMessage with AutoIt.

The codes are listed in TOTALCMD.INC:
cm_ConfigSaveSettings=580;Save current paths etc.
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

ZoSTeR,

Many many thanks for the answer. I'll try it and report back.
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 »

Hi all,

I promised to report back ... Failure.

Here are the relevant lines in my program:
*********************************************
interface
uses ...
// I added:
const
TC_Save_Config = WM_USER + 51;

// in Private:
private
{ Private declarations }
procedure OnMyMessage(var Msg: TMessage); message TC_Save_Config;

// in FormActivate:
procedure TForm1.FormActivate(Sender: TObject);
VAR
...
h: HWND;
begin
h := FindWindow(nil, 'Total Commander'); // OK, TC IS FOUND (I checked)
if IsWindow(h) then SendMessage(h, TC_Save_Config, 580, 580); // I don't know how to send the 580.
// **************************************
and nothing happens in WinCmd.ini.

What am I doing wrong ??
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Try getting the handle by the class name: TTOTAL_CMD
I guess that would be:

h := FindWindow('TTOTAL_CMD', nil);
if IsWindow(h) then SendMessage(h, TC_Save_Config, 580, 0);

You can use WinSpector to see the incoming messages and correct handles.
Last edited by ZoSTeR on 2014-03-22, 11:26 UTC, edited 1 time in total.
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

ZoSTeR,

Many MANY thanks !!! This:

h := FindWindow('TTOTAL_CMD', nil);

worked.

The weird part is that with the window name I checked and it was found as well. h := FindWindow(nil, 'Total Commander'); // OK

Windows oddities ???

Great ! Thanks again.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

The is another window: "TApplication | Total Commander" that is found first. This is new since 8.x I guess.
eitang
Senior Member
Senior Member
Posts: 250
Joined: 2003-05-19, 20:08 UTC
Location: France
Contact:

Post by *eitang »

>> The is another window:

Ah! And this one does not send 580 to TC, I guess...

Thanks again. My proggy works well now.
Best Wishes,

Eitan Gilboa (License #: 17011)
URL: https://eitang.pagesperso-orange.fr/
Post Reply