c#调用GetWindowText函数
2015-08-27 15:35
621 查看
[DllImport("user32.dll")] public static extern int GetWindowTextLength(IntPtr hWnd); [DllImport("User32.dll", CharSet = CharSet.Auto)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int nMaxCount); int length = GetWindowTextLength(hWnd); StringBuilder windowName = new StringBuilder(length + 1); GetWindowText(hWnd, windowName, windowName.Capacity);
用DllImport声明GetWindowText时,千万别跟第2个参数加out。
相关文章推荐
- C# 类的属性,方法,事件
- 知识点滴(一) c#副屏设置以及读写ini文件的方法
- 实现Textbox+listBoxControl拼音检索 C#
- C# 实现无边框窗口拖动
- C#中实现文本框的滚动条自动滚到最底端
- C# 工厂单例
- c#中预处理指令来实现条件编译
- C# 单例3种写法
- c#中各种进制之间转换
- 【c#】关于终止以及删除主进程创建的线程以及进程的方法
- c#中ToString()格式化数据
- C#编程获取资源文件中图片的方法
- C#动态创建button的方法
- c# 服务程序重启自身
- C# PPT 为形状设置三维效果
- C#中图片与BASE64码互相转换
- C#动态调用WCF接口
- c# 右下角弹窗提示
- C#生成音频文件以及转换成需要的格式
- C# PPT 为形状设置三维效果