Click to See Complete Forum and Search --> : Copying Text
softweng
September 21st, 2001, 02:00 PM
I have an app that runs in the background all the time. If IE is open and the hotkey(F2) is pressed
my app becomes visible. I need some help in one area though. I need to copy text that is highlighted
on the web page into a textbox on my form. Can anyone tell me how to do this? I have tried and
tried but have not had any success.
Thanks for any help provided. All posts that help me with this problem will be rated.
Kris
Software Engineer
Phoenix,AZ
Clearcode
September 25th, 2001, 04:49 AM
Obtain a window handle to Explorer and before you bring your application to the foreground send it a WM_COPY message with the SendMessage API call.
If any text is selected it will be copied to the clipboard.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
softweng
September 25th, 2001, 10:08 AM
I tried that exactly as you have described and it does not work. I know I had the correct hWnd to
the window because I could change the window title bar text. I have figured out a different
way to do this. I added my program to the right click menu of IE and used javascript to get the
highlighted text then open my app and pass the text as a command line argument. Works great.
Kris
Software Engineer
Phoenix,AZ
Clearcode
September 25th, 2001, 10:22 AM
Hmm - does Sendkeys "^C" work?
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
softweng
September 25th, 2001, 10:56 AM
Nope that didn't work either. I tried several different ways but no luck. The JavaScript works
great though.
Kris
Software Engineer
Phoenix,AZ
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.