1.生成可传参数的WinForm文件,主要修改Form1.cs 和Program.cs文件:
Program.cs 改Main方法为有参数的
Form1.cs:构造方法Form1改为带参数,里面可以对入参作处理,新建一个方法Form1_Load() ,里面主要写此exe实现的功能。
2.将编译后的exe文件拷贝到需要调用的文件中,
3.调用exe代码: sTxtPath为exe生成的日志,返回值在日志里面读取,直接返回的方法还没找到。
sLisExeFilePath为要调用的exe文件。
sTxtContent为读到exe生成的日志中的值
string sTxtPath = Directory.GetCurrentDirectory() + "\\OCRLog\\" + "YXOutValues.txt";
WriteLog.Write("sTxtPath:" + sTxtPath);
string sLisExeFilePath = @"OcrDiscern.exe";
string sOutValues = "";
try
{