Jump to content
Sign in to follow this  
Zohar

How to Check Selection Length, even If CurrentControl is not a Known Control?

Recommended Posts

Zohar

Hello

I know how to check the Selection's Length for regular EDIT control - I do it via _GUICtrlEdit_GetSel($CurrentControl_Handle).

But let's say the selected text can be in many other types of Text Writing Controls,

for example Microsoft Word, or any other thing.

Is there a way to ask windows something about the Selection, without asking Current Control about it?

Some kind of API that check if anything is Selected, and then the Length of it?

If I try to simulate Ctrl-C, use ClipGet(), and then Check the Length of the returned value, there's 1 problem:

If nothing is selected, then the returned value is the last Ctrl-C that the user has done.

So it's not a reliable way

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites
somdcomputerguy

Maybe do a ClipGet first, then Ctrl-C and another ClipGet. Check the two ClipGet values, if they're not equal, Check the Length.. Not perfect though, if the second Copy is supposed to be the same as the second one...or you could do as AdmiralAlkex posted..

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Zohar

Hi :)

Thank you for the ideas.

those 2 ideas will actually get what I want,

however the only disadvantage is that the first will Clear the clipboard, even if nothing is selected,

and the second can thin nothing is selected, if the same string is selected like before.

So I should assume there's no API that can check the Length of the Selection?

If anyone knows, please write me..

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.