Execution of program during login
Hi,
I have a program which has to run on the administrator machine continuously. The problem is if the user logs off, the process gets stopped and a lot of users use the administrator machine daily(log in with their id and log off). I want to invoke my program each time a user logs in.How do i do that. Can i use scheduled tasks. if so how do i do that. Can anyone help me out.
Re: Execution of program during login
Add it to the Start-Up or just change it to w Windows Service. Windows Service run even when noone is logged in.
Re: Execution of program during login
How do I change it to a Windows service. I do not know anything about that. Can you tell it in detail.
Re: Execution of program during login
Quote:
Originally Posted by Chandana Sameera
How do I change it to a Windows service. I do not know anything about that. Can you tell it in detail.
If all the program does is some background processing then you can convert it to a Windows Service. Also remember Windows services do not have a User Interface. So if your application has a User Interface then it is better to add it to the Start-Up folder in the Programs window.
To create a Windows Service you will need a control named NTSVC.OCX. I tried searching for it on MS few days back but I think as VB 6 is not supported anymore so they have removed it from the site. You can do a search here or at www.planetsourcecode.com for a quick sample of developing a Windows Service in VB 6.
Re: Execution of program during login
It has a user interface. It actually connects to a database retrieves information anf fills up excel sheets everyday at a particular time. The problem is only with the logging off. It stops once theuser logs off. Will it stop if user logs off in case i place in startup and if we place in startup will it start when user logs in or when the system is started. Can you tell me in detail how to add it to startup. I tried but it was not working.
Re: Execution of program during login
or you can use srvany to run your program as a service, do a search on "servany"
pete
Re: Execution of program during login
Quote:
Originally Posted by Chandana Sameera
It has a user interface. It actually connects to a database retrieves information anf fills up excel sheets everyday at a particular time. The problem is only with the logging off. It stops once theuser logs off. Will it stop if user logs off in case i place in startup and if we place in startup will it start when user logs in or when the system is started. Can you tell me in detail how to add it to startup. I tried but it was not working.
Any application that is running under a particular user account does stop once the user logs off. Even if you have added an application to the startup it will start automatically but once the user logs off it will stop.
Try to add it to Scheduled Tasks and see if it runs properly.
Re: Execution of program during login
add a shortcut in the all users start folder
it should then start whenever anyone logs in
pete
Re: Execution of program during login
Hi
It's a bit confusing to let an application run when there's no user logged-in. If the application is allowed to end when the user logs-off, but should run as soon as another user logs on, and you don't mind "fiddling" with the registry, I might have a solution for you......
Open REGEDIT.EXE
Create a new "String Value" in the registry under the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Give it an appropriate name and enter the path of your application as a value.
So, for example, you'll have a new string value as follows:
NAME: MyApp
VALUE: "C:\Program Files\My App\MyApp.exe"
This will run the program when any user logs on to the system.
Hope it helps! :)
The reason why I prefer entering it to the registry, is so that end-users cannot "access" it as easily as the shortcuts in the "All Users" startmenu folder. EG: They can delete the shortcut no problem, but in the registry, they'll have quite a hard time to find and delete the value...
Re: Execution of program during login
My project has two parts. One is an automation tool that runs always and a configuration ool to configure my automation tool. When i am configuring the automation tool has to stop execution and when i stop the configuration tool i want to launch it once again. But now my automation tool is running as a service. Is there any way to start and stop the services through VB. Does anyone know that. If it is not possible can anyone suggest an alternative.
Re: Execution of program during login
Re: Execution of program during login
But will it run the program even during logoff or will it run only if someone is logged on
Re: Execution of program during login
that code in the thread sets the program to run at startup. it is intended to be executed in a separate application.
if that code is executed successfully, the program you set to run at startup will execute everytime you open your pc or log on to it.
Re: Execution of program during login
What should HKEY_CURRENT_USER be defined as. It is giving a compile time error
Re: Execution of program during login
Re: Execution of program during login
Quote:
Is there any way to start and stop the services through VB. Does anyone know that. If it is not possible can anyone suggest an alternative.
you could use NET STOP to stop a service
pete
Re: Execution of program during login
Can we register an EXE as a windows service manually. If so how can we do it. Can anyone tell it to me in detail.
Re: Execution of program during login
vb applications are not normally able to run as a service, though there are several ways to get round that problem.
there is an ocx that can be added to a project
there is sample code someplace, google "run service"
or there is a service (by microsoft) that will run other applications as a sevice, which is the best (only?) solution for software written by some one else google "srvany"
there are limitations as to what programs can do when run as a service
i have a "stay on top" vb exe i wrote and run as a service using srvany, but every so often (maybe once a week or 2) it gets lost and i have to use task manager to to switch to itand bring it back on top
pete