Any way to get filename under cursor?
Moderators: white, Hacker, petermad, Stefan2
Any way to get filename under cursor?
Please, it is possible to get filename under cursor? I want to send it to my LCD display, but - there is no way to get name through LB_GETCARETINDEX & LB_GETTEXT, why? And - if i use cm_CopyNamesToClip, then there is a "No files selected" message on top of dir. Very sad... Sure is there no way?
...to define recurse, we must to define recurse first...
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
No, currently we dont know how to get the filename. Probably Christian is able to tell us what message to use, if he is willing to. On the other hand, the utility CopyText does get the filenames, so it is a well known method... for others. AFAIK, CopyText is able to get data from Delphi controls, so the secret could be some Delphi dll call.
I switched to Linux, bye and thanks for all the fish!
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Unfortunately you can't currently get the name. Your only option is to create a starter menu entry or button bar command with parameter %P%N, and then invoke that command from outside.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 48232
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
How could this be done? Most messages do not allow to pass pointers between applications (except for WM_COPYDATA). Any suggestions?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
And what's wrong with WM_COPYDATA?
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 10.52 / Win10 x64
Using TC 10.52 / Win10 x64
mia
Or did you mean internal details? If yes, look in the MSDN, there is an example of usage.
The application sends to TC some special message (e.g. WM_USER+51 with some reserved argument which is not present in totalcmd.inc). TC handles this message and sends WM_COPYDATA back to the application with the name and/or path of the file inside it.Flint: how to use WM_COPYDATA, please?
Or did you mean internal details? If yes, look in the MSDN, there is an example of usage.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 10.52 / Win10 x64
Using TC 10.52 / Win10 x64
Flint: which "special arguments" you mean? I was trying to send some commands not listed in totalcmd.inc and TC not send any WM_COPYDATA message, but show message window "function not implemented".
Edit: I was trying to send command "0" (nothing happens), "1", "2222" (Function not implemented)... I captured messages through "Spy" application, apply filter General, where is WM_COPYDATA message.
Edit: I was trying to send command "0" (nothing happens), "1", "2222" (Function not implemented)... I captured messages through "Spy" application, apply filter General, where is WM_COPYDATA message.
...to define recurse, we must to define recurse first...
mia
I think, you misunderstood me. My replyFlint: which "special arguments" you mean? I was trying to send some commands not listed in totalcmd.inc and TC not send any WM_COPYDATA message, but show message window "function not implemented".
was directed to Christian, not to you! I asked him, why not to implement such a way of getting current file name (send a message to TC -> TC replies with WM_COPYDATA). Of course, it is not working now, because it needs some new functions implemented in TC that are not currently implemented!And what's wrong with WM_COPYDATA?
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 10.52 / Win10 x64
Using TC 10.52 / Win10 x64
Flint: Ups... my mistake , sorry...
Ghisler: Maybe hidden textbox with unique name (for example Filename), where will be passed filename under cursor. Or hidden listbox (SelectedFiles), where will be passed all selected filenames (very useful for creating m3u playlists).
example:
Text_hWnd = FindWindowEx(TC_hWnd, 0, "Filename", 0)
res = SendMessage(Text_hWnd, WM_GETTEXT, length, pointer_of_Name$)
or similar for listbox.
Your current listboxes (TMyListbox) are nonstandard, right? Cursor position is handled OK but in item is nothing.
Ghisler: Maybe hidden textbox with unique name (for example Filename), where will be passed filename under cursor. Or hidden listbox (SelectedFiles), where will be passed all selected filenames (very useful for creating m3u playlists).
example:
Text_hWnd = FindWindowEx(TC_hWnd, 0, "Filename", 0)
res = SendMessage(Text_hWnd, WM_GETTEXT, length, pointer_of_Name$)
or similar for listbox.
Your current listboxes (TMyListbox) are nonstandard, right? Cursor position is handled OK but in item is nothing.
Last edited by mia on 2006-06-25, 20:33 UTC, edited 1 time in total.
...to define recurse, we must to define recurse first...
In any predefined or registered message it is possible to pass the handle to global allocated memory. Application can use GlobalAlloc.Any suggestions?
Code: Select all
HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, MAX_PATH);
Code: Select all
if (GlobalSize(hMem)>=MAX_PATH)
{
char *ptr=GlobalLock(hMem);
strncpy(ptr,FileName,MAX_PATH);
GlobalUnlock(hMem);
}
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
One small comment: it IS possible to get the filename at present, we just have to find out how. I hoped Christian will tell us the method, but I'm afraid he does not know this either. Maybe the author of CopyText will enlighten us. I would write an email to him, but unfortunately there is no valid email address now
If someone knows some good Delphi gurus, they could tell us what Delphi specific calls are needed to get the actual text from an owner drawn listbox.
If someone knows some good Delphi gurus, they could tell us what Delphi specific calls are needed to get the actual text from an owner drawn listbox.
I switched to Linux, bye and thanks for all the fish!