Cái này mình làm có thể lấy text bằng cách bôi đen nhấn Ctrl+C hoặc kéo thả , code cực ngắn và không đòi hỏi kiến thức api hook gì hết (đương nhiên chức năng bị hạn chế), nhưng bạn nào không có yêu cầu quá cao như mtd hay babylon, stardict thì dùng cũng được:
Cho cái timer là 200(nhỏ hơn cảng tốt) và gán enable = true nhé.
Mã:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices; namespace Lab{ public partial class Form1 : Form { String s; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { if (Clipboard.ContainsText(TextDataFormat.UnicodeText)) s = Clipboard.GetText(TextDataFormat.UnicodeText); } private void timer1_Tick(object sender, EventArgs e) { if (Clipboard.ContainsText(TextDataFormat.UnicodeText) && s != Clipboard.GetText()) textBox1.Text = s = Clipboard.GetText(TextDataFormat.UnicodeText); } private void textBox1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.UnicodeText)) e.Effect=DragDropEffects.Copy; else e.Effect =DragDropEffects.None; } private void textBox1_DragDrop(object sender, DragEventArgs e) { textBox1.Text = e.Data.GetData(DataFormats.UnicodeText).ToString(); Clipboard.SetText(s, TextDataFormat.UnicodeText); //dòng này cần thiết, nếu bạn dùng office 2003 hỗ trợ nhiều clipboard, mà dùng chung 2 tính năng lẫn nhau thì sẽ bị lỗi đó } private void checkBox1_CheckedChanged(object sender, EventArgs e) { timer1.Enabled = !timer1.Enabled; } }}
View more random threads:
Rocket 1h là thực phẩm chức năng giúp tăng cường sinh lý nam có nguồn gốc hoàn toàn từ dược liệu tự nhiên. Rất nhiều nam giới đã tuyển lựa Rocket 1h như một phương thuốc hữu hiệu để cải thiện tình...
Nguyên nhân của cặp đôi nam nữ mua...