Click here to Skip to main content
Rate this: bad
good
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()
        {
            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 5-Dec-12 2:35am
Edited 5-Dec-12 2:38am
v2

1 solution

Rate this: bad
good
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[^].
  Permalink  
Comments
Imon Bayazid at 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 at 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
0 Maciej Los 424
1 ridoy 410
2 DamithSL 240
3 OriginalGriff 179
4 Suvendu Shekhar Giri 150
0 OriginalGriff 8,033
1 DamithSL 6,179
2 Sergey Alexandrovich Kryukov 5,538
3 Maciej Los 5,508
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 5 Dec 2012
Copyright © CodeProject, 1999-2014
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