VC to write a graphical interface of the Windows service program

Source: Internet
Author: User
Tags command line

Environment: Windows 2003,VC 6.0

Absrtact: Start with a COM service program, then transform an MFC project into a service program, and finally let this program display a graphical interface at startup.

Keyword: Windows service program COM Service starts NT service and desktop interaction before booting

One, what is the Windows service program?

You can see it using the following methods.

Open the Control Panel, then the Management tool, which has a "service", double-click and open;

or by entering the command, open the Start menu, click Run, input MMC services.msc (MMC can be omitted), can also open;

We'll see a big list on the open page with names, descriptions, status, startup type, login status, and so on. The services that are already started on the system are shown as "started" in the Status column. Let's look at the properties of the service first. For example, find the name of the print spooler, and then right-click on it, select Properties, and you can see that the command line it executes is C:\WINDOWS\system32\ Spoolsv.exe, the Spoolsv.exe process exits in Task Manager after you press stop. The list we see is the focus of the service program, and each item is a service program.

These service programs, which are marked as starting from the above, are started with the system. It with some modifications to the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Items, and a program similar to a registry key, are run even if the user is not logged on to the system, or they run before the system logs on.

Second, how to establish their own service procedures?

Each service program corresponds to a subkey under the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. So we can increase the service program by adding a registry entry. For example, I want to add a test1 service now, the corresponding executable file is C:\test1.exe. Then I want to add the following registry key:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.