110,571
社区成员
发帖
与我相关
我的任务
分享
//Program.cs
namespace CallHelloworld{
static class Program{
static string wsReferenceArg = string.Empty;
[STAThread]
static void Main(string[] args){ //注意此处,添加字符串数组参数
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
wsReferenceArg = args[0]; //Helloworld方法所需的参数值。
Application.Run(new Form1(){StartupArg=wsReferenceArg});
}
}
}
//Form1.cs
public class Form1:Form{
private string _startupArg;
public string StartupArg{
set{_startupArg = value;}get{return _startupArg;}
}
private void Form1_Load(object sender, EventArgs e){
workreportform.WebReference.WebService a = new workreportform.WebReference.WebService();
a.Helloworld(this.StartupArg);
}
}
下面就是Windows任务了。这个你查一下资料就好了。
假设你编译后的exe文件名叫:runatserver.exe
那么在Windows定时任务中(以10:09分为例)D:\runatserver.exe "BT100"。注意runatserver.exe后面有空格。