日期:2014-05-20 浏览次数:20728 次
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;
using System.Collections;
using System.Diagnostics;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public delegate void HotkeyEventHandler(int HotKeyID);//热键事件委托
private int Hotkey1;
private const int WM_HOTKEY = 0x0312; // 热键消息编号
public class Hotkey : System.Windows.Forms.IMessageFilter
{
Hashtable keyIDs = new Hashtable();//热键哈希表
IntPtr hWnd;
public event HotkeyEventHandler OnHotkey; //热键事件
public enum KeyFlags//控制键编码
{
MOD_ALT = 0x1,
MOD_CONTROL = 0x2,
MOD_SHIFT = 0x4,
MOD_WIN = 0x8
}
[DllImport("user32.dll")]