Solved

.NET GUI Application does not run using Task Scheduler when user is logged off

Posted on 2006-11-06
4
378 Views
Last Modified: 2008-01-16
I have a .NET GUI Application that runs successfully via Task Scheduler when I am logged in or the PC is locked but it does not work when I am logged off (PC is still running) I verified that a different app (console based) that simply deletes a DIR runs fine even when I am not logged in.

I know that the App. runs in invisible mode when run by Task Scheduler when the user is not logged in. Is it an issue if the GUI Application uses Button.PerformClick() to trigger certain application logic? The application also launches a broswer window if needed, would this be an issue?

Thanks in advance for your help.
0
Comment
Question by:mubeen76
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
qz8dsw earned 125 total points
ID: 17886711
hokies, I think I'm right on these assumptions,

Sounds like it would be alot better suited to be a service in XP and just have a timer based trigger.
However you have to realise you actually have no buttons, it has no gui or desktop to start on when you are logged off so no where to place it's form even though it's invisible. Using form based trigger then I would expect to fail.

Launching a browser would be much the same, it might be able to launch it, but wether it could interact with it the way you want is another thing entirely.

I used a service to interact with Word via ADO which works fine, A scheduled event just did not work for much the same reasons you are striking.
I had to give the service a proper username and password so it could load a profile to interect with.
Because it used network resources (Much like yours would be with a browser I'm assuming) it would need a valid username and password that could use the network. The localsystem account for a service although has full access to the local machine, it has totally no access to anything on the network.

I hope this helps.

Terry
 

0
 
LVL 15

Expert Comment

by:qz8dsw
ID: 17886722
Well, or you could re-write it not to depend on or use gui based triggers.
0
 

Author Comment

by:mubeen76
ID: 17890096
hmm.. thanks qz8dsw. Is there a way I can tell in my application if it required the Task Scheduler to login? The thing is I want the user to possibly interact with the UI when the Task runs when the user is logged in but have it run in console mode when the user is not logged in.

0
 

Author Comment

by:mubeen76
ID: 17893559
I found a way to test if the application is running in invisible mode. When I call ShowDialog it throws the exception below and I can hence infer the mode. Thanks!

System.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at CEASIRLoader.frmMainPage.frmMainPage_Load(Object sender, EventArgs e)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

There are 2 things you must have in order to connect to the internet behind a router, The "Gateway IP" of the router, which is usually something like 192.168.xxx.1, I've seen routers with default values of: 192.168.0.1, 192.168.1.1, 192.168.11.1, …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now