Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2007

Tip: Looking for answers? Try searching our database.

How to differentiate between a program launched manually and launched by a windows task scheduler ???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mayur_hirpara@hotmail.com - 05 Jan 2007 21:13 GMT
Hi,
I am writing a VB.NET application. It is a Windows application at the
moment.
The application contains a button. the click event of button perform a
long running task.
It needs to be started by windows task scheduler to carry out some
operation.

When I am testing the application I want to differentiate if the
"differentiate between a program launched manually and launched by a
windows task scheduler" so that in the load event of form I can call
the function which carries out long running task when application is
started by scheduler OR else if it ws launched manually then nothing
will happen automatically. USer will have to click the button to
perform the operation.

Again can someone show me ....
How to differentiate between a program launched manually and launched
by a windows task scheduler ???

Any help is greatly appreciated....
Thanks in advance,
--Mike.
Mattias Sjögren - 06 Jan 2007 08:55 GMT
>How to differentiate between a program launched manually and launched
>by a windows task scheduler ???

I think the easiest way is to configure Task Scheduler to pass in an
extra command line parameter that you then can check for in your Main
procedure.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Eugene Mayevski - 06 Jan 2007 09:09 GMT
Hello!
You wrote  on 5 Jan 2007 13:13:54 -0800:

mh> Again can someone show me ....
mh> How to differentiate between a program launched manually and launched
mh> by a windows task scheduler ???

http://vbnet.mvps.org/index.html?code/system/getparentprocess.htm

With best regards,
Eugene Mayevski
http://www.SecureBlackbox.com - the comprehensive component suite for
network security
mayur_hirpara@hotmail.com - 08 Jan 2007 22:17 GMT
Great...
Thanks...It works after a little tweak to the parameter types from long
to integer and same for return types may be because I am on windows XP
SP@ at the moment.
In the course of solving this problem I alos found some elegent code
that worked same way...

http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=27395

and
microsoft.public.dotnet.framework
http://groups.google.to/group/microsoft.public.dotnet.framework.aspnet/browse_th
read/thread/9567b59857e8231e/9c1da01e43c2ff49?lnk=st&q=dotnet+th32ParentProcessI
D+-herfried&rnum=8#9c1da01e43c2ff49


Thanks a ton any way for such prompt help...
--Mike

> Hello!
> You wrote  on 5 Jan 2007 13:13:54 -0800:
[quoted text clipped - 9 lines]
> http://www.SecureBlackbox.com - the comprehensive component suite for
> network security

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.