一.注册大漠插件
两种方式
1.Cmd手动注册dll
regsvr32 D:\Project\大漠\DMTest\dm.dll
2.程序注册dll
static string AutoRegCom() { string strCmd = @"regsvr32 D:\Project\大漠\DMTest\dm.dll"; string rInfo; try { Process myProcess = new Process(); ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("cmd.exe"); myProcessStartInfo.UseShellExecute = false; myProcessStartInfo.CreateNoWindow = true; myProcessStartInfo.RedirectStandardOutput = true; myProcess.StartInfo = myProcessStartInfo; myProcessStartInfo.Arguments = "/c " + strCmd; myProcess.Start(); StreamReader myStreamReader = myProcess.StandardOutput; rInfo = myStreamReader.ReadToEnd(); myProcess.Close(); rInfo = strCmd + "\r\n" + rInfo; return rInfo; } catch (Exception ex) { return ex.Message; } }
二.初始化大漠类
引用:using Dm;
声明大漠插件:
dmsoft dm = new dmsoft();
原文地址:https://www.cnblogs.com/tangpeng97/p/12696074.html
时间: 2024-10-12 20:14:15