Double clicking

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DumRat
    New Member
    • Mar 2007
    • 93

    Double clicking

    Hi,
    I have this question which gives me nightmares these days. I need to make an application which can get the highlighted text in any window. Ex: When I run my app, and when I dbl click any word in notepad(say), the highlighted word should be available to my app.
    I am talking in Win32 of course. There is one way that I found out. It uses a mouse hook, and on a dbl-click event, send a WM_COPY command to the foreground window, and then get the clipboard contents. I haven't tried this yet, but guess it'll work. But, can anyone tell me a more general way to get selected text from a window? Thanks.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    That's the whole purpose of the clipboard.

    Off you go.

    Comment

    • DumRat
      New Member
      • Mar 2007
      • 93

      #3
      Originally posted by weaknessforcats
      That's the whole purpose of the clipboard.

      Off you go.
      You sure that dbl-clicked highlighted content go to clipboard? Wikipedia says that UNIX does that, but it does not mention anything like that about windows. I do apologize, I have tried, but had little luck finding resources on this topic.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        I believe in Windows you must implement the clipboard yourself.

        In the case of double-clicking in notepad.exe, the highlighted text is availabkle to your app provided you have implemented the clipbaord. For its part, notepad can move the highlighed text to the clipboard on a ctrl+c (COPY) and your app can paste it by implementing ctrl+v (PASTE).

        These COPY/PASTE are part of the clipboard API. You could, on one of your windows implement a copy to the clipboard every time a double-click was performed but this would conflict with the usual Windows paradigm of double-click means to select and execute, not make a copy.

        Comment

        Working...