回复 10楼 吹水佬
如果将COM另做一个执行文件运行,再使用SendMessage 发送回,此时右键菜单或预览报表状态下,会执行SendMessage传来的命令吗?这函数能发送汉字吗?
SendMessage(lnCallMeHWnd,WM_COPYDATA, 0,@m.lcText)
string sendString = 测试发送数据;
byte[] sarr = System.Text.Encoding.Default.GetBytes(sendString);
int len = sarr.Length;
COPYDATASTRUCT cds;
cds.dwData = (IntPtr)0 ;
cds.cbData = len + 1;
cds.lpData = sendString;
SendMessage(hWnd, WM_COPYDATA, 0, ref cds);
接收方:
if (m.Msg == WMA_InterPro)
{
COPYDATASTRUCT cds = new COPYDATASTRUCT();
Type t = cds.GetType();
cds = (COPYDATASTRUCT)m.GetLParam(t);
string receiveInfo=cds.lpData;
}
[此贴子已经被作者于2023-7-3 12:26编辑过]