Solved

How to tell if the task scheduler or user has opened an application.

Posted on 2008-10-08
2
229 Views
Last Modified: 2013-11-26
I'm developing a small application in Visual Studio 2008 and VB.net. The application can be set by the user to open and perform operations from the Task Schedule. I need some method of detecting whether the application has been opened by the scheduled task or by the user in the normal way. Depending on how the app. is opened, different On Open functions will be performed.
0
Comment
Question by:Al230762
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 250 total points
ID: 22666993
Set up the Task Scheduler to startup your application with a commandline argument. To do this, set the path to your application something like this....

    C:\Path\YourApp.exe t

"t" can be anything you want, as long as there is a space between it and the path to the EXE. Then, in your startup forms Load event, have something like this....

        If My.Application.CommandLineArgs.Count > 0 Then
            MsgBox("Scheduler startup")
        Else
            MsgBox("User Startup")
        End If

Wayne

0
 

Author Closing Comment

by:Al230762
ID: 31504132
Wayne, that's perfect. Thank you for the speedy and clear answer.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

13 Experts available now in Live!

Get 1:1 Help Now