Getting list of select files. How?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Yams
Junior Member
Junior Member
Posts: 24
Joined: 2006-03-07, 18:36 UTC
Location: Tver, Russia
Contact:

Getting list of select files. How?

Post by *Yams »

Hello to all memebers. I am an author of small utilite for Total Commander, its description you can see, for example, here. In a few words, Open File TC allows to open selected files in needed (for user) editor.

And I have a problem with getting a list of selected files. Now I use the following code:

Code: Select all

 TCHnd:= FindWindow('TTOTAL_CMD', Nil);

 // Getting a list of selected files
 if TCHnd<>0 then
 begin
  SaveClipboard;  // save information of clipboard

  // Send a message to the TC
  SendMessage(TCHnd, EM_DISPLAYBAND, CM_CopyFullNamesToClip, 0);
  
  // Receive information from TC
  try
   S:= Clipboard.AsText;
  except
   on E: Exception do S:='';
  end;
  
  RestoreClipboard;  // move all information back to the clip
This code sometimes doesn't work: sometimes RestoreClipboard procedure moves back to the clipboard the wrong text, or it lost user's information - pictures, metafiles, etc.

My question: is there any method to get a list of selected files from TC? Without using a clipboard.

P.S. I try to get this list using a handle of TListBox, but I ensued only numbers of selected items.
In Pascal we trust
User avatar
Munango-Keewati
Junior Member
Junior Member
Posts: 31
Joined: 2003-02-19, 18:45 UTC

Post by *Munango-Keewati »

This may not be what you're looking for, but there is the (undocumented?) cm_ftpaddtolist. Use in Start Menu or as a button, with the target path and filename in the parameters field.

Hope this helps.

M-K
User avatar
Yams
Junior Member
Junior Member
Posts: 24
Joined: 2006-03-07, 18:36 UTC
Location: Tver, Russia
Contact:

Post by *Yams »

The same command is the CM_SaveSelectionToFile. But these command are good for user and not for third-party software :( Because when I send a message to the Total Commander, then TC opens a Open File Dialog.

May be there are some parameters which I can send to Total Commander using SendMessage:

Code: Select all

; Can I use another command, or only EM_DISPLAYBAND? 
; I get example with this command from russian Total Commander site - www.wincmd.ru

SendMessage (TCHnd, EM_DISPLAYBAND, CM_SaveSelectionToFile, Integer(<And here parameters>));
But I don't know what parameters must I send to application. And I don't know is it possible. :)
In Pascal we trust
Post Reply