C# winform 基于HSMS通信的SECS协议窗体程序及类库源码(附下载链接)

C#源码 上位机 SECS协议,里面包含各种进制转换,用于半导体行业,程序全源码

程序源码下载链接:https://download.csdn.net/download/m0_65636467/88421447

程序展示如下

请添加图片描述

请添加图片描述

客户端测试:
请添加图片描述
源码:
在这里插入图片描述
调用HSMS类库代码展示
private void button2_Click_2(object sender, EventArgs e)
{
string ConfigStr = string.Empty;
ConfigStr = hsmsLibCls.ConfigDeviceSxFyString(“S6F11”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 3, null);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, “0”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, “1004”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 1, null);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 2, null);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, “8”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 3, null);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_1, 1, “0”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.ASCII, 12, “AAAAAAAAAAAA”);
ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, “0”);
hsmsLibCls.SendSECSIIMessage(ConfigStr);
}

    private void button4_Click_1(object sender, EventArgs e)
    {
        string ConfigStr = string.Empty;
        ConfigStr = hsmsLibCls.ConfigDeviceSxFyString("S6F12");
        string str1 = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.BOOLEAN, 1, "0x00");
        hsmsLibCls.SendSECSIIMessage(ConfigStr);
    }

    private void button10_Click_1(object sender, EventArgs e)
    {
        string ConfigStr = string.Empty;
        ConfigStr = hsmsLibCls.ConfigDeviceSxFyString("S6F11");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 3, null);
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, "0");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, "1004");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 1, null);
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 2, null);
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, "8");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.LIST, 3, null);
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_1, 1, "0");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.ASCII, "D:\\Log20_07\\01.txt".Length, "D:\\Log20_07\\01.txt");
        ReturnStr = hsmsLibCls.DataItemOut(ref ConfigStr, HsmsClass.SECSDataType.UINT_4, 1, "0");
        hsmsLibCls.SendSECSIIMessage(ConfigStr);
    }
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
要在C# Winform中嵌入基恩士应用程序exe,可以使用Process类来启动应用程序,并将其嵌入到窗体中。以下是实现步骤: 1. 打开Visual Studio中的Winform项目,并在工具箱中添加一个Panel控件。 2. 在代码中使用Process类的Start方法来启动基恩士应用程序exe,并将其嵌入到Panel控件中。 3. 设置基恩士应用程序exe的属性和方法,以便与其进行交互。 以下是代码示例: ```csharp using System.Diagnostics; using System.Windows.Forms; namespace WinformApp { public partial class Form1 : Form { private Process process; public Form1() { InitializeComponent(); // 启动基恩士应用程序exe process = new Process(); process.StartInfo.FileName = "KeenShine.exe"; process.StartInfo.Arguments = ""; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.Start(); // 将基恩士应用程序exe嵌入到Panel控件中 process.WaitForInputIdle(); SetParent(process.MainWindowHandle, panel1.Handle); // 设置窗体大小和位置 process.StartInfo.WindowStyle = ProcessWindowStyle.Normal; process.WaitForInputIdle(); MoveWindow(process.MainWindowHandle, 0, 0, panel1.Width, panel1.Height, true); // 设置基恩士应用程序exe的属性和方法 process.StandardInput.WriteLine("Command1"); var result = process.StandardOutput.ReadLine(); // ... } protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); // 关闭基恩士应用程序exe process.Kill(); } [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll")] private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint); } } ``` 在上面的代码中,panel1是Winform中的一个Panel控件,用来显示基恩士应用程序exe。你需要根据实际情况设置基恩士应用程序exe的属性和方法。需要注意的是,在关闭窗体时,需要使用Process类的Kill方法来关闭基恩士应用程序exe。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

薪薪代码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值