Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using advapi32.dll to install a service
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01155465
Message ID:
01155715
Views:
27
Hi Anatoliy,

what does WMI stand for?

From what I gathered from the link, the code doesn't create a service. The logic I need is:

Check if service exists, if it does delete it.
Create the service and start it.

I've got pretty close, but have a slight problem with the definition of:
DECLARE INTEGER CreateService IN advapi32;
	INTEGER hSCManager,;
	STRING lpServiceName,;
	STRING lpDisplayName,;
	LONG dwDesiredAccess,;
	LONG dwServiceType,;
	LONG dwStartType,;
	LONG dwErrorControl,;
	STRING lpBinaryPathName,;
	STRING lpLoadOrderGroup,;
	INTEGER lpdwTagId,;
	STRING lpDependencies,;
	STRING lpServiceStartName,;
	STRING lpPassword

m.lnService = CreateService(m.lnSCM,;
   m.tcServiceName, ;
   m.tcServiceName, ;
   SERVICE_ALL_ACCESS, ;
   SERVICE_WIN32_OWN_PROCESS, ;	
   SERVICE_AUTO_START,;
   0,;
   m.tcFileName,;
   "",;
   0,;
   "",;
   "",;
   "")
I have a feeling the problem is the INTEGER lpdwTagId.


>Not exactly a sharing, but the WMI version of this code is free:
>
>Encapsulating access to the Windows Services in a class
>http://www.news2news.com/vfp/?example=476
>
>API functions used:
>CloseServiceHandle
>ControlService
>EnumServicesStatus
>GetLastError
>LocalAlloc
>LocalFree
>LockServiceDatabase
>OpenSCManager
>OpenService
>StartService
>UnlockServiceDatabase
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform