C#win32.TaskScheduler.dll帮助!创建任务,无论用户已登录还是注销 [英] C# win32.TaskScheduler.dll Help! Create task whether user is logged in or off

查看:86
本文介绍了C#win32.TaskScheduler.dll帮助!创建任务,无论用户已登录还是注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名CS学生,正在休假.

我正在制作一个使用win32.Taskscheduler库的程序.我正在尝试创建一个无论用户是登录还是注销都可以运行的任务.我不知道该怎么做.我尝试做
303行:

Hi I am a CS student who is taking their summmer vacation.

I am making a program that uses the win32.Taskscheduler library. I am trying to create a task that runs whether the user is logged in or off. I dont know how to do this. I tried doing
Line 303:

newTask.Principal.LogonType = TaskLogonType.InteractiveTokenOrPassword;


但这给了我一个我不明白的错误.
302行:


but it gives me an error that I don''t understand.
Line 302:

TaskDefinition newTask = item.ts.NewTask();


有帮助吗?
异常错误是:


Any help?
The exception error is:

System.NullReferenceException: Object reference not set to an instance of an object.
   at ManualZipHelper.CreateTask.createTask(TaskScheduleItem item) in C:\Users\sl9400\documents\visual studio 2010\Projects\ZipHelper\ManualZipHelper\CreateTask.cs:line 310
   at ManualZipHelper.CreateTask.button1_Click(Object sender, EventArgs e) in C:\Users\sl9400\documents\visual studio 2010\Projects\ZipHelper\ManualZipHelper\CreateTask.cs:line 160


第310行:


Line 310:

item.ts.RootFolder.RegisterTaskDefinition(@"zipHelperTask", newTask, TaskCreation.Create, item.ts.UserName.ToString(), item.ts.UserPassword.ToString(),TaskLogonType.ServiceAccount, null);

推荐答案

您是否注意到此页面 [ ^ ] ???它包含库中的文档,并且可能仅包含您问题的答案.
Have you noticed the TaskSchedulerHelp.zip file on this page[^]?? It contains the documentation on the library and may just hold the answer to your question.


这篇关于C#win32.TaskScheduler.dll帮助!创建任务,无论用户已登录还是注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆