|
-
Jul 10th, 2006, 04:36 AM
#1
Thread Starter
New Member
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.
-
Jul 10th, 2006, 04:44 AM
#2
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.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 10th, 2006, 04:48 AM
#3
Thread Starter
New Member
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.
-
Jul 10th, 2006, 04:51 AM
#4
Re: Execution of program during login
 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.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 10th, 2006, 05:00 AM
#5
Thread Starter
New Member
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.
-
Jul 10th, 2006, 05:01 AM
#6
Re: Execution of program during login
or you can use srvany to run your program as a service, do a search on "servany"
pete
-
Jul 10th, 2006, 05:52 AM
#7
Re: Execution of program during login
 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.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 10th, 2006, 06:05 AM
#8
Re: Execution of program during login
add a shortcut in the all users start folder
it should then start whenever anyone logs in
pete
-
Jul 10th, 2006, 08:03 AM
#9
Hyperactive Member
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...
Last edited by BillGeek; Jul 10th, 2006 at 08:05 AM.
Reason: Forgot to mention...
-
Jul 11th, 2006, 12:15 AM
#10
Thread Starter
New Member
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.
-
Jul 11th, 2006, 12:35 AM
#11
Frenzied Member
Re: Execution of program during login
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Jul 11th, 2006, 12:40 AM
#12
Thread Starter
New Member
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
-
Jul 11th, 2006, 12:59 AM
#13
Frenzied Member
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.
On error goto Trap
Trap:
in case of emergency, drop the case...
****************************************
If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option. if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar
-
Jul 11th, 2006, 02:49 AM
#14
Thread Starter
New Member
Re: Execution of program during login
What should HKEY_CURRENT_USER be defined as. It is giving a compile time error
-
Jul 11th, 2006, 03:25 AM
#15
Lively Member
Re: Execution of program during login
Hklu
-
Jul 11th, 2006, 03:32 AM
#16
Re: Execution of program during login
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
-
Jul 11th, 2006, 04:41 AM
#17
Thread Starter
New Member
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.
-
Jul 11th, 2006, 04:49 AM
#18
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
Last edited by westconn1; Jul 11th, 2006 at 04:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|