I had some ideas for my Services2 plugin and I'm currently trying to implement them. One of them involves calling TC Lister with a parameter. Is it possible to do that using PostMessage?
Here's what I tried (not all of them at once of course):
var s: PString;
begin
New(s);
s:= PString(FService.Executable);
if NOT PostMessage(FhTotalCmd, TotalCmdMsg, cm_List, LParam(s)); then
Dispose(s);}
PostMessage(FhTotalCmd, TotalCmdMsg, cm_List, LongInt(PChar(FService.Executable)));
PostMessage(FhTotalCmd, TotalCmdMsg, cm_List, Integer(@FService.Executable)));
TC receives the message fine in all of the above cases but ignores the executable given by lParam and loads the file under the cursor instead. Is there any way to use PostMessage or some other internal function?
New in Version 4.50 (30.6.00):
[...]
- cm_List now allows to open a file. The file name must be given directly behind CM_LIST, and not in the parameters field!
Example: cm_list c:\windows\wincmd.ini always opens the file wincmd.ini in lister.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Well, it is a special interpretation of cm-command call, it can't work via window message of course. TC simply process such button differently. The only way to send a string message is WM_COPYDATA message.
ghisler(Author) wrote:Why not start a standalone copy of lister? That's much easier!
Yes, I know that as you can see in OP. I already implemented this and it's working perfectly. However, using a separate process has some disadvantages, for example: the separate "Lister process" doesn't close its window when the TC instance in foreground (and my plugin) is closed.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Hurdet wrote: 2024-11-03, 09:25 UTCHow you create %Temp%\_tc\file.txt in plugin? how referer _tc?
TC passes the path to the local file when calling the plugin interface function FsGetFile of a WFX plugin. The plugin can then write to that file. When viewing a file within a WFX plugin via F3 TC passes a path somewhere within %TEMP%\_tc [1], and it passes the opposite panel's path when copying a file from a plugin via F5.
[1] Note that this path is not fixed. It can change when TC needs multiple temporary directories simultaneously. I've seen %TEMP%\_tc_ and similar directory names.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
I haven't bothered implementing opening internal Lister as I requested here. It's too much effort without some cooporation from TC's side.
You can wait for a window to close if you know its handle. Getting that handle is probably the hard part since Lister plugins might change the Lister window's title.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Dalai wrote: 2024-11-03, 11:27 UTC
I haven't bothered implementing opening internal Lister as I requested here. It's too much effort without some cooporation from TC's side.
But you now try to pass 19781 in dwData and "cm_list C:\Windows\Temp\_tc\vds.Stopped" in lpData in you copydata code?
It work fine for me and it is simple.
Hurdet wrote: 2024-11-03, 11:38 UTCBut you now try to pass 19781 in dwData and "cm_list C:\Windows\Temp\_tc\vds.Stopped" in lpData in you copydata code?
What's this magic number 19781?
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Ah, I see. I tried it and it works. Unfortunately it requires TC 9.0 or higher, as can be read in this thread Collected infos about WM_COPYDATA, WM_USER+50 and WM_USER+51 in TC. The plugin interface version is exactly the same, so a plugin is pretty clueless about whether or not the running TC supports this kind of command. And I don't want to check the running TC's version either. But I would need to know if the running TC supports that to be able to disable/hide the items referring to internal Lister calls. It comes back to what I said before: it's not so easy without some coorporation or indication from TC.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64