WM_COPYDATA "CD" in right Panel

English support forum

Moderators: sheep, Hacker, Stefan2, white

Hurdet
Senior Member
Senior Member
Posts: 474
Joined: 2003-05-10, 18:02 UTC

WM_COPYDATA "CD" in right Panel

Post by *Hurdet »

When i send WM_COPYDATA "CD" command it every open path in left panel.
How to open in right Panel?

User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

Try to send cm_FocusRight (code 4002) before sending "cd"

Hurdet
Senior Member
Senior Member
Posts: 474
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

I had already tried it but it does not solve

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

Post by *MVV »

Hurdet,
String that you send with WM_COPYDATA as lpData has following format:

Code: Select all

#EF#BB#BF ['<left_path>'] #0D #EF#BB#BF ['<right_path>'] #00 ['S'] ['T'] #00

Code: Select all

["\xEF\xBB\xBF"] ["<left_path>"] "\x0D" ["\xEF\xBB\xBF"] ["<right_path>"] "\x00" ["S"] ["T"] "\x00"
Here [] means optional part. If "S" is specified, left panel means source and right means target. If "T" is specified, dirs are opened in new tabs. Finally, "\xEF\xBB\xBF" part means that your path are in UTF-8 encoding. Don't forget that cbData value must contain string length including terminating null character.

Good luck!right_path
Last edited by MVV on 2013-05-24, 09:31 UTC, edited 2 times in total.

Hurdet
Senior Member
Senior Member
Posts: 474
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

I'm not able to undstand the string to send with WM_COPYDATA.
I tryed "right_path\x00CD" but not work.

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

Post by *MVV »

Of course it doesn't work, "CD" shouldn't be in this string.

Try this:

Code: Select all

char data[]="\rC:\\Windows\0";
COPYDATASTRUCT cds;
cds.dwData='DC';
cds.lpData=data;
cds.cbData=sizeof(data);
SendMessage(hTcWnd, WM_COPYDATA, 0, (LPARAM)&cds);

Hurdet
Senior Member
Senior Member
Posts: 474
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

It now work but i have also a annoyng messagebox "ERROR! Driver not found" with:
"<right_path>\rC:\\Windows\0"

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

Post by *MVV »

You know, <left_path> and <right_path> are just placeholders, you should replace them with paths (or empty strings). Try just "\rC:\\Windows\0" like in my example. It should change right panel's path to C:\Windows. Then simply replace C:\Windows with your path.

As I wrote (check string format), you must specify left and right paths separated by '\r' character, and you may omit any path if you don't need to change it.

Hurdet
Senior Member
Senior Member
Posts: 474
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

it work fine now. Ty :)

dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

Sorry for kicking this up, but I managed to get this working in my application environment with a lot of help.

code:

Code: Select all

str data="d:\test\0[13]C:\Windows\0"	
COPYDATASTRUCT cds;
cds.dwData='D'<<8|'C';
cds.lpData=data;
cds.cbData=data.len+2;
SendMessage(w WM_COPYDATA 0 &cds)
The above code opens in left panel: 'd:\test' and in right panel 'c:\windows'. Using '\r' does not work, I have to send it as a [13] character code.

Is there someone who could give an example on how to
- put the focus on the left panel
- open a .tab file located in "d:\tabs\test.tab" (if this is possible)

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

@dragonetti
Please refer to this thread: New WM_COPYData Examples

Syntax and explanations for AHK, AutoIT -- which make it fairly easy once setup to pass various commands directly to TC.

dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

Thank you for the reply, I already tried to find the answer in that thread.
Because I couldn't formulate a correct syntax from that thread, I decided to up this thread (and because the syntax structure used in this thread was/is very similar to the syntax I use in my environment).

I will ask again in that example thread if my attempts keep failing.

Thank you.

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

You could do this, with AHK at least:

Code: Select all

SendMessage, 0x433, 4002, 0x0,, ahk_class TTOTAL_CMD
If you have multiple instances of TC running then you will want to differentiate between them, and get the ID instead.

e.g.

Code: Select all

#SingleInstance, Force
#Warn
#NoEnv
SetTitleMatchMode, Regex

wID:=WinExist("^[^\[]+ ahk_class TTOTAL_CMD")
SendMessage, 0x433, 4002, 0x0,, ahk_id %wID%
where, this Regex "^[^\[]+" will match a TC window that doesn't begin with a bracket: '[2] Total Commander'
Thus will match the first instance of TC.

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

Post by *MVV »

dragonetti,
Which environment/language do you use?

Balderstrom,
I think it is not correct to find a handle for TC window w/o brackets in its title. You may have multiple instances and one with brackets may be active, and it is logical to change dir in it but not in inactive/minimzied first instance.

dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

Thank you for the replies.

The environment I work in is 'quick macros' . The program let's you record macros but also let's program macros/mini applications in it's own language.

from the author:
Quick Macros is programmed using C++ (>50%) and QM language (<50%). Most of code is mine, but parts are from various libraries, for example PCRE for regular expressions, scintilla for editor, mailbee for email.

The language is not based on other languages. Something is similar to C++, something to some other languages.
A screenshot that can give you a little impression about the language/syntax:
http://www.quickmacros.com/images/ss/debug.png

This code worked perfectly to navigate to the desired directories in their desired target panels (Left / Right)
str data="d:\test\0[13]C:\Windows\0"
COPYDATASTRUCT cds;
cds.dwData='D'<<8|'C';
cds.lpData=data;
cds.cbData=data.len+2;
SendMessage(w WM_COPYDATA 0 &cds)
I have no C++ experience but the quick macros language can make use of it to a certain extent. And in some parts it may look a bit like it.

Sorry that I can't be more specific, but I hope this gives you some clarification.

Post Reply