Click here to Skip to main content
15,885,804 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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()
        {
            InitializeComponent();
            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)
           {
             Clipboard.Clear();
            
              // i want to copy the selected text 
              //from any document(like pdf, .html ,txt)
             // when i double-click a text
          
        }
    }//form
}


Now what should i do.
I tried in many ways i failed to do that.
Posted
Updated 5-Dec-12 1:38am
v2

1 solution

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[^].
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900