How to detect a cursor position?
Moderators: Hacker, petermad, Stefan2, white
How to detect a cursor position?
Hi all, for using in my home-theatre PC i need to detect, if cursor stay at file or directory. It is possible? Exist any internal command for TC, like result=sendmessage(tc.hWnd, WM_USER+something, any, any), that returns for example 1 for file and 2 for directory? Thanks for answer(s).
- ghisler(Author)
- Site Admin
- Posts: 50541
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
There is possible to detect position of cursor, when i send message LB_GETCARETINDEX or LB_GETCURSEL to listbox "TMyListBox", this message returns index of position of cursor. But there is not possible to get text or any other data from index of cursor? When i send message LB_GETITEMDATA or LB_GETTEXT, returns zero or empty string
Is any other way?

- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
There must be, because CopyText works well with TMyListBox. This means, it behaves in this sense just like a standard listbox.
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
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
2SanskritFritz
Well, you agree listbox is is ownerdrawn but you say "text is not drawn by owner". A little contradiction, isn't?
Most probably CopyText uses some undocumented features.
Did you notice warning in readme? And it is exactly what happens to me after several attempts to copy from TC.
Well, you agree listbox is is ownerdrawn but you say "text is not drawn by owner". A little contradiction, isn't?

Most probably CopyText uses some undocumented features.
Did you notice warning in readme?
Code: Select all
Warnings
========
This program may sometimes fail to get text, or even crash another
application. Unfortunately, the bugs of this sort are to be expected:
CopyText demands a certain default behavior from window classes of the
other applications. In some of cases, when these demands are
not met, CopyText cannot function properly.
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
2VadiMGP
Well the conclusion is: TC uses a normal list box spiced up a little, and the text is drawn by standard windows means, any application should be able to read its contents, the only problem is, i dont know what messages to send
Ownerdrawn does not mean, that everyting is drawn by the host application, it merely means, that in addition to the standard features, a program can hook in, adding some extra features, like colouring, etc.Well, you agree listbox is is ownerdrawn but you say "text is not drawn by owner". A little contradiction, isn't?
It is not CopyText which uses undocumented features, but the controls you want to copy from. CopyText can only use known messages of some known standard controls (list box, combo box, check box, radio button etc). If a control is not a standard windows control, CopyText will fail to copy from it, or even recongnize the control.Most probably CopyText uses some undocumented features.
I use CopyText for maybe 10 years now, and often copy text from TC, never had any problems. I tried just now, no problems.And it is exactly what happens to me after several attempts to copy from TC.
Well the conclusion is: TC uses a normal list box spiced up a little, and the text is drawn by standard windows means, any application should be able to read its contents, the only problem is, i dont know what messages to send

I switched to Linux, bye and thanks for all the fish!
mia
Maybe, this will help: send command cm_CopyNamesToClip to TC, this will copy to the clipboard the current file's name. If this is a directory, it will end with backslash "\" like "MyFolder\", so you will be able to easily determine what you need.
Unfortunately, this will not work if some files or folders are selected: the command above will copy all the selected items' names then...
Maybe, this will help: send command cm_CopyNamesToClip to TC, this will copy to the clipboard the current file's name. If this is a directory, it will end with backslash "\" like "MyFolder\", so you will be able to easily determine what you need.
Unfortunately, this will not work if some files or folders are selected: the command above will copy all the selected items' names then...
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
Using TC 11.03 / Win10 x64
Using TC 11.03 / Win10 x64
2SanskritFritz
In general - yes. But I wrote "in this case". If you want to store strings in ownerdrawn listbox you have to add LBS_HASSTRINGS style. Does TC listbox have this style?Ownerdrawn does not mean, that everyting is drawn by the host application, it merely means, that in addition to the standard features, a program can hook in, adding some extra features, like colouring, etc.
How you know this? Do you have sources of CopeText? Did you tried to write similar application using documented features only?It is not CopyText which uses undocumented features,
Oh, only your problem is message? I'm glad to help you!any application should be able to read its contents, the only problem is, i dont know what messages to send

So please, could you write small application to send CB_GETLBTEXT message to TC list box and retrieve strings?Microsoft wrote:LB_GETTEXT
An application sends an LB_GETTEXT message to retrieve a string from a list box.
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary