Click here to Skip to main content
11,930,843 members (55,205 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
my Code is here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using MouseKeyboardActivityMonitor.WinApi;
using MouseKeyboardActivityMonitor;
namespace dictionar_demo_1
    public partial class MainForm : Form
        private readonly KeyboardHookListener m_KeyboardHookManager;
        private readonly MouseHookListener m_MouseHookManager;
        public MainForm()
            m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker());
            m_KeyboardHookManager.Enabled = true;
            m_MouseHookManager = new MouseHookListener(new GlobalHooker());
            m_MouseHookManager.Enabled = true;
            m_KeyboardHookManager.KeyPress += HookManager_KeyPress;            

        private void HookManager_KeyPress(object sender, KeyPressEventArgs e)
            string x = string.Format("{0}", e.KeyChar);
            if (x == "f")
                m_MouseHookManager.MouseDoubleClick += HookManager_MouseDoubleClick;         

         private void HookManager_MouseDoubleClick(object sender, MouseEventArgs e)
              // i want to copy the selected text 
              //from any document(like pdf, .html ,txt)
             // when i double-click a text

Now what should i do.
I tried in many ways i failed to do that.
Posted 5-Dec-12 2:35am
Edited 5-Dec-12 2:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The first thing you must do is to copy the characters in the word into a memory location. How you do this will depend on the location of the text and how it is being displayed. Once you have the text then posting it to the clipboard is a simple matter of calling the SetText() method[^].
Imon Bayazid 5-Dec-12 8:46am
My main headache is to copy the word to the clipboard.How can i do that??Do you have any solution? @Richard MacCutchan
Richard MacCutchan 5-Dec-12 9:02am
I just told you what to do, and even gave you a link to the documentation that explains how to copy to the clipboard.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 5 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100