Solved

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

Posted on 2006-11-06
4
416 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 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XP Pro desktop dropping itnernet connection 11 136
Obtaining an XP pro key for exercising downgrade rights. (Australia) 11 124
Move XP PC to Vmware 22 167
Windows 7 Share with XP 22 209
Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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