hotkey with highlighted text

TripleD

New member
Joined
Jul 31, 2012
Messages
4
Programming Experience
Beginner
Hi Again,

Sorry for probably simple questions, but I'm only on day 5 of playing with VB.
I decided to build an application to help me learn as watching video's and reading books was a bit boring.

For my application (Only when it's running), I'd like to be able to highlight some text anywhere inside windows (notepad, IE, Excel etc.), and press a hotkey like WinKey + A, it will then launch my application and pass it the highlighted text.

I've been googling, but not really found what I'm looking for, so if you have any sample code, or reference links I'd be grateful.

Thanks!

David...
 
Why is it that when Day 5 learners choose a project to help them learn they inevitably choose something which is Day 555 stuff? Can I suggest that you start by using standard cut and paste to transfer the text to begin with and when your program is actually working then you might begin to think about command parameters and then when they're working you can look at clipboard functions and then when they're working maybe begin to think about the kind of API manipulation that you'd need?
 
Hi,
Thanks do your reply, I understand where your coming from.
My application is currently working, it's not massive it's just based on some integration I wanted to do at work, and this part would finish it off nicely.
Day 4 was pretty much spent packaging it up with an installer and creating splash screens and icons with photoshop, and today I wasn't happy with using stream reader/writers for my settings file, so I integrated it into the registry.

I've found some references on hotkeys but not really found much about how to take highlighted text and pass it into my app.

Any tips would be much appreciated.
 
Well, that's where all the difficulty is, that's why. To even detect that a highlight has been made you need to make several calls to API functions and set up a message hook to intercept and interpret mouse and program events alongside your hotkey monitoring program. The only attempt I have seen at this for the hobbyist is now extremely old (programmed in VB6). I'm not saying it's impossible but I really don't know that it's in your best interests to be wrestling with these kind of issues at this stage in your learning.

You should make a start along the road, however, by getting to grips with command line arguments which will at least enable you to launch the program with particular text.

My.Application.CommandLineArgs Property
 
Back
Top