没有合适的资源?快使用搜索试试~ 我知道了~
sendmessage 使用实例
3星 · 超过75%的资源 需积分: 34 30 下载量 169 浏览量
2011-12-09
09:50:17
上传
评论
收藏 41KB DOC 举报
温馨提示
试读
3页
sendmessage 文本框 消息参数
资源推荐
资源详情
资源评论
向另一个程序中的六个文本框发送内容
using System.Runtime.InteropServices;
private IntPtr hwnd_win;
const int WM_SETTEXT = 0x000C;//文本类型参数
//根据窗体的标题查找窗体的句柄,第一个参数是窗体类名,一般为null。
第二个参数是窗体的标题
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string
lpClassName, string lpWindowName);
//遍历所有子窗体
[DllImport("user32.dll")]
public static extern int EnumChildWindows(int
hWndParent, CallBack lpfn, int lParam);
//发送消息,第一个参数是接收窗体的句柄,第二个参数是消息的标识,
第三个、和第四个参数是附加信息,是可选的。
[DllImport("user32.dll", EntryPoint = "SendMessage",
CharSet = CharSet.Auto)]
private static extern long SendMessage(IntPtr hwnd, int
wMsg, int wParam, string lParam);
/// <summary>
/// 回调业务
/// </summary>
public delegate void CallBusiness(IntPtr hwnd);
public delegate bool CallBack(IntPtr hwnd, int lParam);
/// <summary>
/// 遍历子窗体的父窗体句柄
/// </summary>
public static CallBack callBackEnumChildWindows = new
CallBack(ChildWindowProcess);
/// <summary>
/// 委托业务,需要客户端添加
/// </summary>
public static CallBusiness CallFuntion;
/// <summary>
/// 遍历子窗体或控件
/// </summary>
/// <param name="hWnd"></param>
/// <param name="lParam"></param>
/// <returns></returns>
public static bool EnumChildWindows(IntPtr hWnd, int
资源评论
- a-good-man2013-11-21不错,对于初学者来说 还是不错的
Bingo_world
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功