PC Review


Reply
Thread Tools Rate Thread

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

 
 
mayur_hirpara@hotmail.com
Guest
Posts: n/a
 
      5th Jan 2007
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.

 
Reply With Quote
 
 
 
 
Phil Wilson
Guest
Posts: n/a
 
      5th Jan 2007
If you're the one adding the program to the Task Scheduler, can't you just
add a command line option?

BTW do you mean the Scheduled Tasks feature or the AT command?
--
Phil Wilson
[Microsoft MVP Windows Installer]
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Michael M.
Guest
Posts: n/a
 
      5th Jan 2007
The only things I can think of is using a command line switch such as

Program.exe /autostarted

You could then add that to the Applications Windows Text

Me.Text = "Program Name" & Switch value.

You could then use the API function getWindowText to retrive it

Another way is to write the programs PID process Id to the registry with
this same cmd line switch and the second program reads it

Lastly you could use Custom Windows API Messages to query the process using
SEND MESSAGE API

Or, actualy, why not rename the second application and have two files?


All of the above assume that I am that you are writing the program that will
be scheduled though.
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
mayur_hirpara@hotmail.com
Guest
Posts: n/a
 
      8th Jan 2007
Hi,
I had also posted this question on following microsoft news-group
microsoft.public.dotnet.framework
One of the persons replied with a link to VB6 code that worked after a
little tweak to parameter types and return types.

However, I also found following links which seem to be equally
helpful...

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

and

http://groups.google.to/group/micros...1da01e43c2ff49

Thanks,
--Mike




Michael M. wrote:
> The only things I can think of is using a command line switch such as
>
> Program.exe /autostarted
>
> You could then add that to the Applications Windows Text
>
> Me.Text = "Program Name" & Switch value.
>
> You could then use the API function getWindowText to retrive it
>
> Another way is to write the programs PID process Id to the registry with
> this same cmd line switch and the second program reads it
>
> Lastly you could use Custom Windows API Messages to query the process using
> SEND MESSAGE API
>
> Or, actualy, why not rename the second application and have two files?
>
>
> All of the above assume that I am that you are writing the program that will
> be scheduled though.
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why this program doesn't work if Outlook is not manually launched? qwerty123456 Microsoft Outlook VBA Programming 4 24th Jul 2009 04:54 PM
How to differentiate between a program launched manually and launched by a windows task scheduler ??? mayur_hirpara@hotmail.com Microsoft Dot NET Framework 3 8th Jan 2007 10:17 PM
HELP - Program launched from with Powerpoint =?Utf-8?B?RC4gQnJvb2tz?= Microsoft Powerpoint 0 23rd May 2006 05:07 PM
WMI script launched by Scheduler Scott Windows XP WMI 2 21st Sep 2005 11:34 AM
Wrong program was launched Jason Qi Windows XP Internet Explorer 3 18th Jun 2004 05:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 PM.