摘要: using System;using System.Collections.Generic;using System.Windows.Forms;using System.Runtime.InteropServices;namespace test{ static class Program { [DllImport("user32.dll ", CharSet = CharSet.Unicode)] public static extern IntPtr PostMessage(IntPtr hwnd, int wMsg, IntPtr wParam,... 阅读全文
posted @ 2012-11-20 16:49 北冥子 阅读(1281) 评论(0) 推荐(0) 编辑
摘要: 根据标题获取窗口句柄using System; using System.Runtime.InteropServices; namespace tstfindwindow { /// /// Class1 的摘要说明。 /// class Class1 { [DllImport( "User32.dll ")] public static extern System. IntPtr FindWindowEx(System. IntPtr parent, System. IntPtr childe, string strclass, string st... 阅读全文
posted @ 2012-11-20 15:38 北冥子 阅读(4828) 评论(0) 推荐(0) 编辑
摘要: 可以通过C#中的DllImport直接调用这些已经存在的功能(比如Windows中的一些功能,C++中已经编写好的一些方法)。DllImport所在的名字空间 using System.Runtime.InteropServices;MSDN中对DllImportAttribute的解释是这样的:可将该属性应用于方法。DllImportAttribute 属性提供对从非托管 DLL 导出的函数进行调用所必需的信息。作为最低要求,必须提供包含入口点的 DLL 的名称。DllImport 属性定义如下:namespace System.Runtime.InteropServices{ [Attr. 阅读全文
posted @ 2012-11-20 15:26 北冥子 阅读(868) 评论(0) 推荐(0) 编辑
摘要: 方法一:private void textBox1_Enter(object sender, EventArgs e) { InputLanguage il = InputLanguage.InstalledInputLanguages[0]; InputLanguage.CurrentInputLanguage = il; } private void textBox1_Leave(object sender, EventArgs e) { InputLanguage il = InputLanguage.InstalledInputLanguages[1]; InputLa... 阅读全文
posted @ 2012-11-20 14:43 北冥子 阅读(926) 评论(0) 推荐(0) 编辑