Home > Software engineering >  Vc service program can't start with opencv related code.
Vc service program can't start with opencv related code.

Time:09-22

Under Windows 10, vc write service program, as long as the program contains opencv service will not be able to start the related code, can be normal to comment out it all started,
A similar situation?

CodePudding user response:

May be the opencv something useful to the user session, and the service session without a desktop, etc

CodePudding user response:

reference 1st floor oyljerry response:
may be opencv something useful to the user session, and the service session without desktop such as

Service set up interact with the desktop, but you said that I thought of system permissions and token of some problems, I added a try

CodePudding user response:

 with a debugger (such as OD, WINDBG) debugging service program 
To debug the initialization code of a service application, the debugger must be attached when the service is started. This is accomplished by creating a registry key:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ Image File Execution Options \ ProgramName


The ProgramName is The image file for The service application you are was debugging. Do not specify a path. For example, The ProgramName took look like MyService. Exe.

Under this key The create a string data value called The Debugger. The value of this string should be set to The full path of The Debugger that will be 2. For example,

C: \ Debuggers \ windbg exe



In addition to setting this registry key, the service application must be marked as "interactive". This allows your service to interact with the desktop, and allows the debugger window to appear on your desktop.

This again requires modifying a registry key, you must bitwise - or the type entry for service with 0 x100 (This is the value for SERVICE_INTERACTIVE_PROCESS "according to Winnt. H). The exact location and the name of This registry entry around the for example:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ MyServiceKey


Finally, you need to adjust the service application timeout. Otherwise, the service application will kill the debugger within 20 seconds after starting, Adjusting the timeout involves setting an entry in the following registry key:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control


Under this key, the create a DWORD data value called ServicesPipeTimeout. Set this entry to the amount of time in milliseconds that want the service to wait before timing out. For example, 60000 is one minute, while 86400000 is 24 hours.

Set to come into force after ServicesPipeTimeout need to restart the system

Now, when the service is started, the debugger will also start. When the debugger starts, it will stop at the initial process breakpoint, before the service has begun running. This allows you to set breakpoints or otherwise configure your debugging session to let you monitor the startup of your service. Another option is to place calls to the DebugBreak function in your service from the point at which you would like to break into the debugger. (For more information, see DebugBreak in the Platform SDK documentation.)

If your service is running with other services in a service Host Process, you may need to isolate the service into its own service Host Process.

CodePudding user response:

Library file path, right? If lack of libraries

CodePudding user response:

Doubt is a DLL library path problem

CodePudding user response:

This problem is not configured properly
  • Related