using System;using SystemDrawing;
using SystemCollections;
using SystemComponentModel;
using SystemWindowsForms;
using SystemData;
using SystemRuntimeInteropServices;
namespace WindowsApplication
{
/// /// Form 的摘要说明
///
public class Form : SystemWindowsFormsForm
{
/// /// 必需的设计器变量
///
private SystemComponentModelContainer components = null;
public Form()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// /// 清理所有正在使用的资源
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
componentsDispose();
}
}
baseDispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// /// 设计器支持所需的方法 不要使用代码编辑器修改
/// 此方法的内容
///
private void InitializeComponent()
{
thislabel = new SystemWindowsFormsLabel();
thislabel = new SystemWindowsFormsLabel();
thislabel = new SystemWindowsFormsLabel();
thislabel = new SystemWindowsFormsLabel();
thislabel = new SystemWindowsFormsLabel();
thisSuspendLayout();
//
// label
//
thislabelAutoSize = true;
thislabelLocation = new SystemDrawingPoint( );
thislabelName = label;
thislabelSize = new SystemDrawingSize( );
thislabelTabIndex = ;
thislabelText = EoStion制作;
//
// label
//
thislabelAutoSize = true;
thislabelLocation = new SystemDrawingPoint( );
thislabelName = label;
thislabelSize = new SystemDrawingSize( );
thislabelTabIndex = ;
thislabelText = 使用方法;
//
// label
//
thislabelAutoSize = true;
thislabelLocation = new SystemDrawingPoint( );
thislabelName = label;
thislabelSize = new SystemDrawingSize( );
thislabelTabIndex = ;
thislabelText = 将序列号拷贝到剪切板;
//
// label
//
thislabelAutoSize = true;
thislabelLocation = new SystemDrawingPoint( );
thislabelName = label;
thislabelSize = new SystemDrawingSize( );
thislabelTabIndex = ;
thislabelText = 将光标定位到序列号输入处;
//
// label
//
thislabelAutoSize = true;
thislabelLocation = new SystemDrawingPoint( );
thislabelName = label;
thislabelSize = new SystemDrawingSize( );
thislabelTabIndex = ;
thislabelText = 按F键;
//
// Form
//
thisAutoScaleBaseSize = new SystemDrawingSize( );
thisClientSize = new SystemDrawingSize( );
thisControlsAdd(thislabel);
thisControlsAdd(thislabel);
thisControlsAdd(thislabel);
thisControlsAdd(thislabel);
thisControlsAdd(thislabel);
thisName = Form;
thisText = SN输入工具(C#版Version);
thisFormClosing += new SystemWindowsFormsFormClosingEventHandler(thisForm_FormClosing);
thisLoad += new SystemEventHandler(thisForm_Load);
thisResumeLayout(false);
thisPerformLayout();
}
#endregion
/// /// 应用程序的主入口点
///
[STAThread]
static void Main()
{
ApplicationRun(new Form());
}
[DllImport(userdll SetLastError=true)]
public static extern bool RegisterHotKey( IntPtr hWnd
// handle to window
int id // hot key identifier
KeyModifiers fsModifiers // keymodifier options
Keys vk // virtualkey code
);
[DllImport(userdll SetLastError=true)]
public static extern bool UnregisterHotKey( IntPtr hWnd
// handle to window
int id // hot key identifier
);
[Flags()]
public enum KeyModifiers
{
None =
Alt =
Control =
Shift =
Windows =
}
private void ProcessHotkey()//主处理程序
{
strKeys = ClipboardGetText();
strKeysReplace( {TAB});
SendKeysSend(strKeys);
}
private Label label;
private Label label;
private Label label;
private Label label;
private Label label;
string strKeys;
private void Form_Load(object sender SystemEventArgs e)
{
labelAutoSize = true;
ClipboardClear();//先清空剪贴板防止剪贴板里面先复制了其他内容
RegisterHotKey(Handle KeysF);
}
private void Form_FormClosing(object sender FormClosingEventArgs e)
{
UnregisterHotKey(Handle );//卸载快捷键
}
protected override void WndProc(ref Message m)//循环监视Windows消息
{
const int WM_HOTKEY = x;//按快捷键
switch (mMsg)
{
case WM_HOTKEY:
ProcessHotkey();//调用主处理程序
break;
}
baseWndProc(ref m);
}
}
}