|
-
Jun 15th, 2000, 08:39 AM
#1
Thread Starter
New Member
Using vb6.0
I have a form which is "always on top." I want to be able to select (highlight) text in any app and the click a button on my form (which is on top) and copy the selected text to the clipboard.
I have tried using:
<< Clipboard.SetText Screen.ActiveControl.SelText >>
but, the window containing the highlighted text is no longer the active window.
How do I reference a window which is no longer active (or was the last active)?
I thought about opening apps within a VB window and using:
<< Clipboard.SetText ActiveForm.ActiveControl.SelText >>
but, this is not my best resolve.
Any ideas?
-
Jun 15th, 2000, 11:42 AM
#2
Addicted Member
ok, i don't know if this will work or no,,,but i will give it a go,,,
try to add a timer,,,which checks the selected text,,if there is a selected text then it saves it in a string, it saves the last selected text only,,,then when you press your button,, it copy that string into the clipboard,, i don't have any code right now,,its just an idea
hope it works
-
Jun 15th, 2000, 12:07 PM
#3
Addicted Member
one more thing...
one more thing,, this Screen.ActiveControl.SelText it only woks within your app. , that means it will not work for any other app but yours,,,
-
Jun 15th, 2000, 04:51 PM
#4
Hyperactive Member
Try this.
Private Sub Command1_Click()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
Clipboard.Clear
Clipboard.SetText Text1.SelText
End Sub
-
Jun 15th, 2000, 06:17 PM
#5
Thread Starter
New Member
I understand the limitations of <<screen.ActiveControl.SelText>>
The idea of the timer is interesting, but how do you look for "the last selected text only" especially in another app?
There is a product doing this. They place an icon in the system tray which functions using a left or right mouse click.
Since I want this to function with various file types, I thought about opening a "default-type" viewer within the VB app. This would allow the use of <<screen.ActiveControl.SelText>>.
The problem here is document format. Will I loose the oroginal format? Will the document be too altered as to be unrecognizable...? This is something I wish to market, so it must look (good!).
My first choice is to trythe first approach with external apps. This way, I have less concerns about formats.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|