Solved

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

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

710 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