Results 1 to 6 of 6

Thread: Read Text Globally

  1. #1
    billfaceuk
    Guest

    Read Text Globally

    Say a user highlights some text on a web page how do i copy this selected text to clipboard from my app??? I know this is possible I've seen it done!

  2. #2
    Matthew Gates
    Guest
    Use the SendMessage and send the WM_COPY message to the hwnd (use the WindowFromPoint API function to get the hwnd of which the mouse is over).


    Code:
    Private Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, ByVal _
    wMsg As Long, ByVal wParam As Long, lParam As Any) _
    As Long
    
    Private Const WM_COPY = &H301
    
    
    Private Sub Command1_Click()
        SendMessage hwnd, WM_COPY, 0, 0
    End Sub

  3. #3
    billfaceuk
    Guest
    Ok I'm a little simple wanna go into more detail???

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    But by the time they click on the button, the mouse will be over the button, making the hWnd returned that of the button, which will do nothing. You'll need to make a hotkey that does this.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  5. #5
    Tygur
    Guest
    Even if you use a hotkey, there's no guaranteee that the mouse will be where you want it.

  6. #6
    Matthew Gates
    Guest
    Perhaps a Timer to detect a MouseUp so that the user drags and selects text, than releases the mouse, copy whatever text is selected from the hwnd that the mouse is over.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width