Where do I find the selected data from a left mouse selection or a double click

I need to initiate an action in a mouse right click from a left clicked mouse selection or a double left click selection  text or number from anywhere in a Windows environment.
From the selection, there will be different action taken following the format of the selection.

When you left click and drag select or if you double click a word or a number, where does this gets buffered ? Is there a specific location that we can access to manipulate it ?
Denis TrepanierownerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello ThereSystem AdministratorCommented:
I guess there is something to set in Mouse Options. You can switch right and left mouse and do more things.

If you have a really good mouse, you can also find a related software created by a vendor to re-program it pretty well (e.g. Logitech Gaming Software) - you can create more mouse profiles etc.

A free software usable for many kinds of mice is X-Mouse Button Control. Try it and see.
Very powerfull software is also HydraMouse.
I guess ClickyMouse software allows you to program whatever you want because it uses macros.
Denis TrepanierownerAuthor Commented:
Hi,

Thanks for your reply but I probably didn't explain properly. What I meant was that into our coding (it can be in any language Python, PHP, C#, C++, .NET, golang, JS) we need to have access to the buffer where a selection is stored within Windows in order to trigger, from the selected string, an action.
Use a click to dial exemple.. you select a number and in the right click menu, you code something that will initiate an API to originate a call.

So not related to the hardware but on the software or is you prefer, where does Windows store the selected data that comes from a left click and drag select or a double click select.

Hoping this gets somewhat clearer :)

Thanks !
it_saigeDeveloperCommented:
Using the *primary* mouse button in windows does not normally store anything, anywhere.  When you drag and drop something, that action triggers an event in the operating system which copies/moves the selected item to the new location based upon the:
contract that is established between the AllowedEffect and Effect properties

- Source

It is the Drag event which initiates this contract.  If a target does not support dragging then nothing happens.

As for the *secondary* mouse button, this is usually used to provide a contextual based menu in order to take additional actions.  In general, nothing occurs until you select a context option.  Sometimes though, the result of the events triggered by your mouse actions do store data.  If the combination of your actions does result in data being stored, it is most likely placed on the clipboard.

https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/drag-and-drop-operations-and-clipboard-support

-saige-
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Denis TrepanierownerAuthor Commented:
Thanks Saige,

We'll review the link and will let you know if this fits our needs.

Cheers !!!
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
"from anywhere in a Windows environment"

I take it this means you want to get the selection from any windows app (not just your own)?  This is nearly impossible to do for all conditions as there are many types of controls and no one realiable way to get the "selection" from them.  I suppose you could start with a low level mouse hook (do a search for "WH_MOUSE_LL", you'll get tons of hits and examples) to determine when a drag or double click has occurred.  Then you could use APIs to figure out the control under the mouses current position; the WindowFromPoint() API.  Finally, the hard part is getting the selected text...perhaps you could start with the EM_GETSEL and WM_GETTEXT messages.  I don't have it all worked out, let me know how it goes.
Denis TrepanierownerAuthor Commented:
Many thanks Mike...
I'm still puzzuled though... In my mind, if a selection is made and from a right click, almost any places can do a copy (or if permitted at this place) a cut, this means that the copy/cut function will put in a buffer the selection. So my thoughts goes from the emulation of a CTRL-C to copy the selection then take that selection and paste it into an editable text box where any API command could be generated
or...
to simply use again the same copy and generate any API from what is in the buffer (This is what I'm searching, the buffer where the darn copy puts the selected string).
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
if a selection is made and from a right click

If only a selection is made, then you're in the current situation described.  The data hasn't been placed on any common platform (the clipboard) yet.  There are many different types of Languages and Platforms that have many different capabilities.  For instance, an application designed for the desktop will respond to a completely different set of commands than one developed for a browser.  A "TextBox" written in one language might not respond to the same messages as one written in a different language.

If you're talking about AFTER the user has selected some kind of "Copy" command from a right click menu, then what you're looking for is a "ClipBoard Monitor"; look up examples using the SetClipboardViewer() API.
Denis TrepanierownerAuthor Commented:
Cool again but let me correct my text here above... I meant...  if a selection is made from a LEFT (click and drag or double click) NOT from a right click as there are yet no selection made at this point.

Would this have the same recult you describe ?
Denis TrepanierownerAuthor Commented:
So the exact steps are...
1- At any place where there are alphanumerical caracters, left click and drag or, double left click to make the desired selection.
2- From that selection either
        a) initiate an API command that will use the selected caracters or
        b) paste the selection in an editable text box to change/add/delete parts of the selection and then, issue an API command that will use the modified selection.

Does this make any sense ?
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
That makes sense.  The selection is being made by the control, not the operating system, so as said before, this is not going to be consistent.  You'll need the WH_MOUSE_LL, WindowFromPoint(), EM_GETSEL, and WM_GETTEXT approach for many scenarios.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Denis TrepanierownerAuthor Commented:
Excellemt and thank you Mike,

I'll test this over the next week and will provide our results.

Thanks a bunch again !!!
Denis TrepanierownerAuthor Commented:
Thanks for your appropriate remarks. All good for the moment. Thanks and Cheers !!!
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Mike Tomlinson (https:#a42426539)
-- it_saige (https:#a42424815)
-- Mike Tomlinson (https:#a42426095)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Pber
Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.