首页
Web开发
Windows程序
编程语言
数据库
移动开发
系统相关
微信
其他好文
会员
首页
>
Windows程序
> 详细
C# 发送WM_COPYDATA消息--网络COPY供个人参考
时间:
2015-05-10 00:58:40
阅读:
379
评论:
0
收藏:
0
[点我收藏+]
标签:
using
System.Runtime.InteropServices;
[DllImport(
"
User32.dll
"
, EntryPoint
=
"
FindWindow
"
)]
private
static
extern
IntPtr FindWindow(
string
lpClassName,
string
lpWindowName);
[DllImport(
"
User32.dll
"
, EntryPoint
=
"
SendMessage
"
)]
//
用于发送信息给窗体
private
static
extern
int
SendMessage(IntPtr hWnd,
int
Msg, IntPtr wParam,
ref
COPYDATASTRUCT lParam);
[StructLayout(LayoutKind.Sequential)]
public
struct
COPYDATASTRUCT
{
public
IntPtr dwData;
public
int
cbData;
public
IntPtr lpData;
}
COPYDATASTRUCT cds;
string
a
=
"
032
"
;
byte
[] sarr
=
System.Text.Encoding.Default.GetBytes(a);
cds.dwData
=
(IntPtr)
0
;
cds.cbData
=
a.Length;
cds.lpData
=
Marshal.AllocHGlobal(sarr.Length);
Marshal.Copy(sarr,
0
, cds.lpData, sarr.Length);
IntPtr p
=
FindWindow(
"
#32770
"
,
"
GetMessage
"
);
SendMessage(p,
0x004A
, (IntPtr)
0
,
ref
cds);
C# 发送WM_COPYDATA消息--网络COPY供个人参考
标签:
原文地址:http://www.cnblogs.com/ande/p/4491493.html
踩
(
0
)
赞
(
0
)
举报
评论
一句话评论(
0
)
登录后才能评论!
分享档案
更多>
2021年07月29日 (22)
2021年07月28日 (40)
2021年07月27日 (32)
2021年07月26日 (79)
2021年07月23日 (29)
2021年07月22日 (30)
2021年07月21日 (42)
2021年07月20日 (16)
2021年07月19日 (90)
2021年07月16日 (35)
周排行
更多
动态 WebApi 引擎使用教程(3行代码完成动态 WebApi 构建)
2021-07-28
windows 查看文件的md5/sha1/sha256
2021-07-28
git windows下换行符问题 LF与CRLF转换
2021-07-27
FileExistsError: [WinError 183] 当文件已存在时,无法创建该文件。
2021-07-26
K8S--可视化界面Kubernetes Dashboard(API Server方式)
2021-07-26
Redis安装成windows服务
2021-07-26
c#32位支持大内存(>2gb)
2021-07-23
【c#】Dev BarStaticItem问题汇总
2021-07-23
Exception: URL fetch failure on https://s3.amazonaws.com/text-datasets/nietzsche.txt: None -- [WinError 10054] 远程主机强迫关闭了一个现有的连接。
2021-07-22
WinForm使用DataGridView实现类似Excel表格的查找替换
2021-07-22
友情链接
兰亭集智
国之画
百度统计
站长统计
阿里云
chrome插件
新版天听网
关于我们
-
联系我们
-
留言反馈
© 2014
mamicode.com
版权所有 联系我们:gaon5@hotmail.com
迷上了代码!