Solved

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to just get time from a date 6 48
Adding where clause to entity statement c# 1 47
Asp.Net Session Question 2 33
VB.net Excel VSTO Add-in version compatability 2 13
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

762 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