?
Solved

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

Posted on 2006-11-06
4
Medium Priority
?
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
qz8dsw earned 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

752 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