|
-
Sep 14th, 2001, 09:56 AM
#1
Starting SQL Server 7.0 Service from ActiveX
I am using the SQLDMO Object Library. I can STOP and PAUSE the SQL Service, can anyone help me with the syntax or code to START the Service????????
Thank you.
-
Mar 17th, 2003, 09:42 PM
#2
Hyperactive Member
-
Mar 19th, 2003, 06:46 AM
#3
Junior Member
Not sure how to do it with the SQLDMO Object Library, but you could use the StartService API function instead.
BOOL StartService(
SC_HANDLE hService, // handle to service
DWORD dwNumServiceArgs, // number of arguments
LPCTSTR* lpServiceArgVectors // array of arguments
);
but you can probably guess that you don't have a handle to the service at this point ... so backing up a bit ...
1) Use the OpenSCManager to simply open the Services database.
2) Using the newly acquired handle to the SC Manager, open the service you're after with OpenService
Now you're in a position to kick off the StartService call.
Don't forget to close the handles when you're finished.
MSDN can be helpful for the specifics.
This is the link for OpenSCManager . It has links to all the other API calls you'll need.
Hope this helps
Dave
Last edited by daughey; Mar 19th, 2003 at 08:48 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
|