Solved

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

Posted on 2008-10-08
2
252 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET MVC 2 31
Datagridview column when exported to Excel changes vb.net 1 13
VB.net and sql server 4 36
parsing JSON help 1 9
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 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