Coverting process for vb6.0 app to NT service

Posted on 2002-03-26
Last Modified: 2008-01-16
Dear experts
I am going to convert a VB 6.0 application to NT service.
I have downloaded an OCX for this purpose from following web site
but the problem is thst I can not understand the whole process that I must follow to converet it into NT service i.e after writing code (that is mentioned in the above web site)what step i should follow. What steps I should follow in this whole converting process.
you should also know that my form should be invisible as ymy service is running.
Waiting anxiously for your response.
Thanks to all genious experts.
Question by:habibb
  • 4

Accepted Solution

EstebanFG earned 20 total points
ID: 6899149
You can use SRVANY to convert a VB executable into an NT Service.
Microsoft's WinNT RESKIT includes a very useful utility that allows you to convert most DeskTop applications into a SERVICE application. This basically means that you can run an application behind the scenes i.e. it doesn't depend on a specific user to log on.
These are the steps that you should follow:

1.     Create a directory under your root and call it SRVANY and copy these three files:
SRVANY.EXE, SRVANY.WRI, and INSTSRV.EXE into the SRVANY directory.  The files come from the WinNT RESKIT.

2.     Go to the DOS Command prompt and navigate to the SRVANY Directory. At the command prompt type:
INSTSRV <service name> c:\srvany\srvany.exe

(Notice the second element on the command line " <service name> ". This is the "name" of the service that you will create. Later, you will go to the SERVICE applet in the CONTROL CENTER and will access the service by this name. Since you are creating a name, you can call it anything you want, so don't be too vague.)

3.     Exit the DOS COMMAND Console, and fire up the REGEDT32.EXE. Be careful while you are in there, don't mess with other stuff.

4.     Open up the HKEY_LOCAL_MACHINE window and double-click on the SYSTEM branch. The branch opens up and you should see the CurrentControlSet branch. Double-click on that one and the Services branch should appear. Double-click on the Services branch and a long list of branches is displayed.

5.     Scroll down until you find the name of the service that you created.

6.     Double-click on the name of your service and leave this highlighted.

7.     Move the cursor up to the EDIT menu bar and click on "Add Key..."

8.     The Add Key dialog box is displayed. In the "Key Name" text box type: Parameters

9.     Highlight the Parameters Key and bring your cursor to the EDIT menu bar again and click on the Add Value choice.

10.     In the "Value Name" text box type in: Application
From the "Data Type" list box choose: REG_SZ
Now press OK

11.     The String Editor Dialog box will open up. Enter the full path to your program's executable.
For example:  c:\MyApp\Sample.exe
Press OK .

12.     Highlight the Parameters Key and once again bring your cursor to the EDIT menu bar again and click on the Add Value choice to add another key.

In the "Value Name" text box type in: AppParameters
From the "Data Type" list box choose: REG_SZ and press OK

13.     When the String Editor dialog box opens up add and opening parameters that your program needs in order to run.  If none are needed, you can skip this step.
Close it all up and exit the REGEDT32 program. Now you can breathe easy again. The worst is over. Move to the Control Panel.

14.     Open up the SERVICE Applet and scroll to the name of your service line and double click on it.

A dialog box opens up. Choose the Startup Type: Automatic (for unattended operation, this will allow your service to be active when there is no one logged on).  If you want this service to run under a specific account,oOn the “Log On” tab, click on “This Account”, then Browse. Highlight the account name and click OK.

15.     Click on OK on the service property box and exit the services.

16.     Reboot the machine.

Author Comment

ID: 6899259
Dear EstebanFG
Thanks for your easy steps I shall increase points upto 5 if I succeeded.
thanks again

Author Comment

ID: 6902082
EstebanFG I have follow your Instructions and succeeded but I am facing some problems. when i press start button (on the serevice applet in control pannel) it display following error message:
Could not start 'Myservicename' service on \\Mycomputername
error 2186 the service is not responding to the control function.
moreover it does not run  even no user is login.
I hope you will understnad my problems.
I am waiting for your Quick response. thanks
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 6909638
wakeup EstebanFG and help me.

Expert Comment

ID: 7014025
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link 
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange

Author Comment

ID: 7020797
Problem in provided solutions. Not exact solution

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

791 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