|
@@ -58,7 +58,7 @@ namespace parkMonitor.server
|
|
|
///<summary>通过设备句柄访问pic;链接时add,系统关闭时remove</summary>
|
|
|
private Dictionary<int, PictureBox> devPicMap = new Dictionary<int, PictureBox>();
|
|
|
///<summary>通过名字获取pic对象;创建pic时add,系统关闭remove</summary>
|
|
|
- private Dictionary<string, PictureBox> picNameMap = new Dictionary<string, PictureBox>();
|
|
|
+ private Dictionary<string, PictureBox> namePicMap = new Dictionary<string, PictureBox>();
|
|
|
///<summary>通过ip获取设备id;产生ip时创建</summary>
|
|
|
private Dictionary<string, int> ipIdMap = new Dictionary<string, int>();
|
|
|
///<summary>通过ip获取设备句柄;产生句柄时创建</summary>
|
|
@@ -67,14 +67,14 @@ namespace parkMonitor.server
|
|
|
private Queue<NumberMachineNode> LicBuffer = new Queue<NumberMachineNode>();
|
|
|
///<summary>计数Map</summary>
|
|
|
private Dictionary<string, Dictionary<NumberMachineNode, int>> filterMap = new Dictionary<string, Dictionary<NumberMachineNode, int>>();
|
|
|
- /// <summary>句柄到图像映射</summary>
|
|
|
- private Dictionary<int, IntPtr> handleImgMap = new Dictionary<int, IntPtr>();
|
|
|
/// <summary>筛选计数</summary>
|
|
|
private int filterCount = 0;
|
|
|
/// <summary>系统关闭</summary>
|
|
|
- private bool closing = false;
|
|
|
+ private bool isClosing = false;
|
|
|
/// <summary>开启拍照的设备</summary>
|
|
|
private int snapshotDevHandle = -1;
|
|
|
+ /// <summary>允许无号牌时拍照</summary>
|
|
|
+ private bool enableEmptySnapshot = true;
|
|
|
|
|
|
private NumberMachineMessage nmMsg = new NumberMachineMessage();
|
|
|
VzClientSDK.VZLPRC_FIND_DEVICE_CALLBACK_EX find_DeviceCB = null;
|
|
@@ -146,7 +146,7 @@ namespace parkMonitor.server
|
|
|
|
|
|
private void UpdateStatus(NumberMachineNode nmn)
|
|
|
{
|
|
|
- while (!closing)
|
|
|
+ while (!isClosing)
|
|
|
{
|
|
|
if (GetStatus(nmn.ip) == 1)
|
|
|
{
|
|
@@ -169,7 +169,7 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- while (!closing)
|
|
|
+ while (!isClosing)
|
|
|
{
|
|
|
Thread.Sleep(REFRESHINGTIME);
|
|
|
//定时返回号牌
|
|
@@ -277,7 +277,7 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
string str = "PictureBox" + Convert.ToString(i);
|
|
|
//该名称对应控件不存在,则创建并链接pic
|
|
|
- if (!picNameMap.ContainsKey(str))
|
|
|
+ if (!namePicMap.ContainsKey(str))
|
|
|
{
|
|
|
PictureBox pic;
|
|
|
if (CreatePic(i, out pic))
|
|
@@ -317,29 +317,31 @@ namespace parkMonitor.server
|
|
|
|
|
|
VzClientSDK.VZ_LPR_MSG_PLATE_INFO plateInfo = new VzClientSDK.VZ_LPR_MSG_PLATE_INFO();
|
|
|
plateInfo.plate = strLicense;
|
|
|
-
|
|
|
+
|
|
|
//根据setMessage中通过id信息找到的handle保存图片
|
|
|
- if (!strLicense.Contains("_无_") && handle == snapshotDevHandle)
|
|
|
+ if (handle == snapshotDevHandle)
|
|
|
{
|
|
|
- string strFilePath = ConfigurationManager.AppSettings["LogPath"] + DateTime.Now.ToString("yyyyMMdd") + "\\";
|
|
|
- if (!Directory.Exists(strFilePath))
|
|
|
- {
|
|
|
- Directory.CreateDirectory(strFilePath);
|
|
|
- }
|
|
|
- string ip = Get_IP(handle);
|
|
|
- string path = strFilePath + ip +"-"+ DateTime.Now.ToString("hh_mm_ss") + ".jpg";
|
|
|
- int temp = VzClientSDK.VzLPRClient_ImageSaveToJpeg(pImgFull, path, 50);
|
|
|
- if (temp!=-1)
|
|
|
- {
|
|
|
- LogFile logFile = LogFile.LOG;
|
|
|
- Log.WriteLog(logFile, "号牌机" + ip + "已拍照,图片保存于 " + strFilePath);
|
|
|
- UILogServer.ins.info("号牌机" + ip + "已拍照,图片保存于 " + strFilePath);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (enableEmptySnapshot || !strLicense.Contains("_无_"))
|
|
|
{
|
|
|
- UILogServer.ins.info("图片保存失败");
|
|
|
+ string strFilePath = ConfigurationManager.AppSettings["LogPath"] + DateTime.Now.ToString("yyyyMMdd") + "\\";
|
|
|
+ if (!Directory.Exists(strFilePath))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(strFilePath);
|
|
|
+ }
|
|
|
+ string ip = Get_IP(handle);
|
|
|
+ string path = strFilePath + ip + "-" + DateTime.Now.ToString("hh_mm_ss") + ".jpg";
|
|
|
+ int temp = VzClientSDK.VzLPRClient_ImageSaveToJpeg(pImgFull, path, 50);
|
|
|
+ if (temp != -1)
|
|
|
+ {
|
|
|
+ LogFile logFile = LogFile.LOG;
|
|
|
+ Log.WriteLog(logFile, "号牌机" + ip + "已拍照,图片保存于 " + strFilePath);
|
|
|
+ UILogServer.ins.info("号牌机" + ip + "已拍照,图片保存于 " + strFilePath);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UILogServer.ins.info("图片保存失败");
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
snapshotDevHandle = -1;
|
|
|
}
|
|
|
int size = Marshal.SizeOf(plateInfo);
|
|
@@ -557,10 +559,10 @@ namespace parkMonitor.server
|
|
|
AutoSize = false,
|
|
|
Name = "PictureBox" + Convert.ToString(index)
|
|
|
};
|
|
|
- if (!picNameMap.ContainsKey(pb.Name))
|
|
|
+ if (!namePicMap.ContainsKey(pb.Name))
|
|
|
{
|
|
|
flowLayoutPanel1.Controls.Add(pb);
|
|
|
- picNameMap.Add(pb.Name, pb);
|
|
|
+ namePicMap.Add(pb.Name, pb);
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
@@ -607,7 +609,7 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
{
|
|
|
- closing = false;
|
|
|
+ isClosing = false;
|
|
|
|
|
|
try
|
|
|
{
|
|
@@ -628,229 +630,229 @@ namespace parkMonitor.server
|
|
|
Run();
|
|
|
});
|
|
|
|
|
|
- //Task imgTest = Task.Factory.StartNew(() =>
|
|
|
- //{
|
|
|
- // while (!closing)
|
|
|
- // {
|
|
|
- // Command cmd = new Command
|
|
|
- // {
|
|
|
- // id = 1
|
|
|
- // };
|
|
|
- // SetMessage(cmd);
|
|
|
- // Thread.Sleep(5000);
|
|
|
- // }
|
|
|
- //});
|
|
|
+ Task imgTest = Task.Factory.StartNew(() =>
|
|
|
+ {
|
|
|
+ while (!isClosing)
|
|
|
+ {
|
|
|
+ Command cmd = new Command
|
|
|
+ {
|
|
|
+ id = 1
|
|
|
+ };
|
|
|
+ SetMessage(cmd);
|
|
|
+ Thread.Sleep(5000);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 系统关闭
|
|
|
- /// </summary>
|
|
|
- public void Stop()
|
|
|
- {
|
|
|
- VzClientSDK.VZLPRClient_StopFindDevice();
|
|
|
- Dictionary<int, PictureBox>.Enumerator enumer = devPicMap.GetEnumerator();
|
|
|
- do
|
|
|
+ /// <summary>
|
|
|
+ /// 系统关闭
|
|
|
+ /// </summary>
|
|
|
+ public void Stop()
|
|
|
{
|
|
|
- if (enumer.Current.Key != 0)
|
|
|
+ VzClientSDK.VZLPRClient_StopFindDevice();
|
|
|
+ Dictionary<int, PictureBox>.Enumerator enumer = devPicMap.GetEnumerator();
|
|
|
+ do
|
|
|
{
|
|
|
- StopPlay(enumer.Current.Key);
|
|
|
- VzClientSDK.VzLPRClient_Close(enumer.Current.Key);
|
|
|
- flowLayoutPanel1.Controls.Remove(enumer.Current.Value);
|
|
|
- }
|
|
|
- } while (enumer.MoveNext());
|
|
|
- closing = true;
|
|
|
- devPicMap.Clear();
|
|
|
- picNameMap.Clear();
|
|
|
- ipIdMap.Clear();
|
|
|
- ipHandleMap.Clear();
|
|
|
- //this.Close();
|
|
|
- }
|
|
|
+ if (enumer.Current.Key != 0)
|
|
|
+ {
|
|
|
+ StopPlay(enumer.Current.Key);
|
|
|
+ VzClientSDK.VzLPRClient_Close(enumer.Current.Key);
|
|
|
+ flowLayoutPanel1.Controls.Remove(enumer.Current.Value);
|
|
|
+ }
|
|
|
+ } while (enumer.MoveNext());
|
|
|
+ isClosing = true;
|
|
|
+ devPicMap.Clear();
|
|
|
+ namePicMap.Clear();
|
|
|
+ ipIdMap.Clear();
|
|
|
+ ipHandleMap.Clear();
|
|
|
+ //this.Close();
|
|
|
+ }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 监控线程获取号牌机信息,核心线程获取号牌信息
|
|
|
- /// </summary>
|
|
|
- public AbstractMessage GetMessage()
|
|
|
- {
|
|
|
- lock (LicBuffer)
|
|
|
+ /// <summary>
|
|
|
+ /// 监控线程获取号牌机信息,核心线程获取号牌信息
|
|
|
+ /// </summary>
|
|
|
+ public AbstractMessage GetMessage()
|
|
|
{
|
|
|
- //准备输出的数据中存在非法Node,且LicBuffer可出队产生一个合法Node,则替换该非法Node,否则让Node=null
|
|
|
- if (!NodeValidation(nmMsg.aNode))
|
|
|
+ lock (LicBuffer)
|
|
|
{
|
|
|
- for (int i = 0; i < LicBuffer.Count; i++)
|
|
|
+ //准备输出的数据中存在非法Node,且LicBuffer可出队产生一个合法Node,则替换该非法Node,否则让Node=null
|
|
|
+ if (!NodeValidation(nmMsg.aNode))
|
|
|
{
|
|
|
- NumberMachineNode n = LicBuffer.Dequeue();
|
|
|
- if (NodeValidation(n))
|
|
|
+ for (int i = 0; i < LicBuffer.Count; i++)
|
|
|
{
|
|
|
- if (nmMsg.aNode != null && nmMsg.aNode.ip != null)
|
|
|
+ NumberMachineNode n = LicBuffer.Dequeue();
|
|
|
+ if (NodeValidation(n))
|
|
|
{
|
|
|
- LicBuffer.Enqueue((NumberMachineNode)nmMsg.aNode.Clone());
|
|
|
+ if (nmMsg.aNode != null && nmMsg.aNode.ip != null)
|
|
|
+ {
|
|
|
+ LicBuffer.Enqueue((NumberMachineNode)nmMsg.aNode.Clone());
|
|
|
+ }
|
|
|
+ nmMsg.aNode = n;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LicBuffer.Enqueue(n);
|
|
|
}
|
|
|
- nmMsg.aNode = n;
|
|
|
- break;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LicBuffer.Enqueue(n);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //if (NodeValidation(nmMsg.aNode) && ipIdMap.TryGetValue(nmMsg.aNode.ip, out int id))
|
|
|
+ //{
|
|
|
+ // nmMsg.aNode.id = id;
|
|
|
+ //}
|
|
|
+ return nmMsg;
|
|
|
}
|
|
|
- //if (NodeValidation(nmMsg.aNode) && ipIdMap.TryGetValue(nmMsg.aNode.ip, out int id))
|
|
|
- //{
|
|
|
- // nmMsg.aNode.id = id;
|
|
|
- //}
|
|
|
- return nmMsg;
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 一次停车流程完成时调用该方法,发送已完成车辆号牌信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="message">已完成车辆的号牌相关信息存于message的aNode中,用于标记需清空的号牌</param>
|
|
|
- public void SetMessage(AbstractMessage message)
|
|
|
- {
|
|
|
- if (message.GetType().Equals(typeof(NumberMachineMessage)))
|
|
|
+ /// <summary>
|
|
|
+ /// 一次停车流程完成时调用该方法,发送已完成车辆号牌信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="message">已完成车辆的号牌相关信息存于message的aNode中,用于标记需清空的号牌</param>
|
|
|
+ public void SetMessage(AbstractMessage message)
|
|
|
{
|
|
|
- NumberMachineNode n = ((NumberMachineMessage)message).aNode;
|
|
|
- lock (LicBuffer)
|
|
|
+ if (message.GetType().Equals(typeof(NumberMachineMessage)))
|
|
|
{
|
|
|
- //输入号牌格式无误
|
|
|
- if (n != null && n.ip != null && n.ip == "")
|
|
|
+ NumberMachineNode n = ((NumberMachineMessage)message).aNode;
|
|
|
+ lock (LicBuffer)
|
|
|
{
|
|
|
- //与类成员变量中aNode号牌相同,将其ip复位表示已使用,重新入队等待清除
|
|
|
- if (nmMsg != null && nmMsg.aNode != null && nmMsg.aNode.LicenseNum.Equals(n.LicenseNum))
|
|
|
- {
|
|
|
- nmMsg.aNode.ip = "";
|
|
|
- LicBuffer.Enqueue((NumberMachineNode)nmMsg.aNode.Clone());
|
|
|
- nmMsg.aNode = null;
|
|
|
- }
|
|
|
- //搜索号牌队列,将相应号牌置空,准备清除
|
|
|
- else
|
|
|
+ //输入号牌格式无误
|
|
|
+ if (n != null && n.ip != null && n.ip == "")
|
|
|
{
|
|
|
- for (int i = 0; i < LicBuffer.Count; i++)
|
|
|
+ //与类成员变量中aNode号牌相同,将其ip复位表示已使用,重新入队等待清除
|
|
|
+ if (nmMsg != null && nmMsg.aNode != null && nmMsg.aNode.LicenseNum.Equals(n.LicenseNum))
|
|
|
{
|
|
|
- NumberMachineNode temp = LicBuffer.Dequeue();
|
|
|
- //已匹配上,ip置空
|
|
|
- if (temp.LicenseNum.Equals(n.LicenseNum))
|
|
|
+ nmMsg.aNode.ip = "";
|
|
|
+ LicBuffer.Enqueue((NumberMachineNode)nmMsg.aNode.Clone());
|
|
|
+ nmMsg.aNode = null;
|
|
|
+ }
|
|
|
+ //搜索号牌队列,将相应号牌置空,准备清除
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < LicBuffer.Count; i++)
|
|
|
{
|
|
|
- temp.ip = "";
|
|
|
+ NumberMachineNode temp = LicBuffer.Dequeue();
|
|
|
+ //已匹配上,ip置空
|
|
|
+ if (temp.LicenseNum.Equals(n.LicenseNum))
|
|
|
+ {
|
|
|
+ temp.ip = "";
|
|
|
+ LicBuffer.Enqueue(temp);
|
|
|
+ break;
|
|
|
+ }
|
|
|
LicBuffer.Enqueue(temp);
|
|
|
- break;
|
|
|
}
|
|
|
- LicBuffer.Enqueue(temp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- //传入异常号牌,根据ip找到handle,改变snapshotDevHandle的值在回调函数中截图
|
|
|
- if (message.GetType().Equals(typeof(Command)))
|
|
|
- {
|
|
|
- Command cmd = (Command)message;
|
|
|
- if (cmd != null && cmd.id != 0)
|
|
|
+ //传入异常号牌,根据ip找到handle,改变snapshotDevHandle的值在回调函数中截图
|
|
|
+ if (message.GetType().Equals(typeof(Command)))
|
|
|
{
|
|
|
- Dictionary<string, int>.Enumerator enumerator = ipIdMap.GetEnumerator();
|
|
|
- do
|
|
|
+ Command cmd = (Command)message;
|
|
|
+ if (cmd != null && cmd.id != 0)
|
|
|
{
|
|
|
- // if (enumerator.Current.Value == cmd.id && ipHandleMap.TryGetValue(enumerator.Current.Key, out int handle))
|
|
|
- int handle = 0;
|
|
|
- if(enumerator.Current.Value == cmd.id && ipHandleMap.TryGetValue(enumerator.Current.Key, out handle))
|
|
|
+ Dictionary<string, int>.Enumerator enumerator = ipIdMap.GetEnumerator();
|
|
|
+ do
|
|
|
{
|
|
|
- snapshotDevHandle = handle;
|
|
|
- break;
|
|
|
- }
|
|
|
- } while (enumerator.MoveNext());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UILogServer.ins.error("参数错误,图片未保存");
|
|
|
+ // if (enumerator.Current.Value == cmd.id && ipHandleMap.TryGetValue(enumerator.Current.Key, out int handle))
|
|
|
+ int handle = 0;
|
|
|
+ if (enumerator.Current.Value == cmd.id && ipHandleMap.TryGetValue(enumerator.Current.Key, out handle))
|
|
|
+ {
|
|
|
+ snapshotDevHandle = handle;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } while (enumerator.MoveNext());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UILogServer.ins.error("参数错误,图片未保存");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
-public class Win32API
|
|
|
-{
|
|
|
- [DllImport("User32.dll", EntryPoint = "FindWindow")]
|
|
|
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
|
|
+ public class Win32API
|
|
|
+ {
|
|
|
+ [DllImport("User32.dll", EntryPoint = "FindWindow")]
|
|
|
+ public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
|
|
|
|
|
- [DllImport("User32.dll", EntryPoint = "FindWindowEx")]
|
|
|
- public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);
|
|
|
+ [DllImport("User32.dll", EntryPoint = "FindWindowEx")]
|
|
|
+ public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 自定义的结构
|
|
|
- /// </summary>
|
|
|
- public struct My_lParam
|
|
|
- {
|
|
|
- public int i;
|
|
|
- public string s;
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 使用COPYDATASTRUCT来传递字符串
|
|
|
- /// </summary>
|
|
|
- [StructLayout(LayoutKind.Sequential)]
|
|
|
- public struct COPYDATASTRUCT
|
|
|
- {
|
|
|
- public IntPtr dwData;
|
|
|
- public int cbData;
|
|
|
- [MarshalAs(UnmanagedType.LPStr)]
|
|
|
- public string lpData;
|
|
|
- }
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- int lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref My_lParam lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
- public static extern int SendMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref COPYDATASTRUCT lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- int lParam // 参数2
|
|
|
- );
|
|
|
-
|
|
|
-
|
|
|
- //消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref My_lParam lParam //参数2
|
|
|
- );
|
|
|
-
|
|
|
- //异步消息发送API
|
|
|
- [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
- public static extern int PostMessage(
|
|
|
- IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
- int Msg, // 消息ID
|
|
|
- int wParam, // 参数1
|
|
|
- ref COPYDATASTRUCT lParam // 参数2
|
|
|
- );
|
|
|
+ /// <summary>
|
|
|
+ /// 自定义的结构
|
|
|
+ /// </summary>
|
|
|
+ public struct My_lParam
|
|
|
+ {
|
|
|
+ public int i;
|
|
|
+ public string s;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 使用COPYDATASTRUCT来传递字符串
|
|
|
+ /// </summary>
|
|
|
+ [StructLayout(LayoutKind.Sequential)]
|
|
|
+ public struct COPYDATASTRUCT
|
|
|
+ {
|
|
|
+ public IntPtr dwData;
|
|
|
+ public int cbData;
|
|
|
+ [MarshalAs(UnmanagedType.LPStr)]
|
|
|
+ public string lpData;
|
|
|
+ }
|
|
|
+ //消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
+ public static extern int SendMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ int lParam //参数2
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ //消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
+ public static extern int SendMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ ref My_lParam lParam //参数2
|
|
|
+ );
|
|
|
+
|
|
|
+ //消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "SendMessage")]
|
|
|
+ public static extern int SendMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ ref COPYDATASTRUCT lParam //参数2
|
|
|
+ );
|
|
|
+
|
|
|
+ //消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
+ public static extern int PostMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ int lParam // 参数2
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ //消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
+ public static extern int PostMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ ref My_lParam lParam //参数2
|
|
|
+ );
|
|
|
+
|
|
|
+ //异步消息发送API
|
|
|
+ [DllImport("User32.dll", EntryPoint = "PostMessage")]
|
|
|
+ public static extern int PostMessage(
|
|
|
+ IntPtr hWnd, // 信息发往的窗口的句柄
|
|
|
+ int Msg, // 消息ID
|
|
|
+ int wParam, // 参数1
|
|
|
+ ref COPYDATASTRUCT lParam // 参数2
|
|
|
+ );
|
|
|
|
|
|
-}
|
|
|
+ }
|
|
|
}
|