Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-08
2
Medium Priority
?
282 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 1000 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

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 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