Re: StartService with arguments
- From: "Mike D Sutton" <EDais@xxxxxxxx>
- Date: Thu, 22 Dec 2005 17:29:57 -0000
> From which Post?
This one, it's showing up here on two different machines (and two different
ISPs)
"Mike D Sutton" <EDais@xxxxxxxx> wrote in message
news:<e6YCPRnBGHA.2644@xxxxxxxxxxxxxxxxxxxx>...
> > I use the WinAPI-Method StartService() to Start a Service.
> >
> > This is from the MSDN:
> >
> > BOOL StartService(
> > SC_HANDLE hService,
> > DWORD dwNumServiceArgs,
> > LPCTSTR* lpServiceArgVectors
> > );
> >
> > This works with StartService(hService, 0, 0). Now, I would to use
> > Arguments.
> > Now, can anybody tell me, how does I have to use the Parameter
> > lpServiceArgVectors in VisualBasic6?
>
> This is untested, but try something like this:
>
> '***
> Private Declare Function StartService Lib "AdvAPI32.dll" Alias
> "StartServiceA" ( _
> ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal
> lpServiceArgVectors As Long) As Long
>
> ...
>
> Dim Args() As String
>
> ' Fill Args[] here
>
> Call StartService(hService, UBound(Args) - LBound(Args) + 1, ByVal
> VarPtr(Args(LBound(Args))))
> '***
>
> If you need the Unicode version then try something like this:
>
> '***
> Private Declare Function StartService Lib "AdvAPI32.dll" Alias
> "StartServiceW" ( _
> ByVal hService As Long, ByVal dwNumServiceArgs As Long, ByVal
> lpServiceArgVectors As Long) As Long
>
> ...
>
> Dim Args() As String
> Dim WideArgs() As Long, LoopArgs As Long
>
> ' Fill Args[] here
>
> ReDim WideArgs(LBound(Args) To UBound(Args)) As Long
> For LoopArgs = LBound(Args) To Ubound(Args)
> WideArgs(LoopArgs) = StrPtr(Args(LoopArgs))
> Next LoopArgs
>
> Call StartService(hService, UBound(Args) - LBound(Args) + 1, ByVal
> VarPtr(WideArgs(LBound(Args))))
> '***
>
> Hope this helps,
>
> Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: EDais@xxxxxxxx
> WWW: Http://EDais.mvps.org/
.
- Follow-Ups:
- Re: StartService with arguments
- From: Thomas Kehl
- Re: StartService with arguments
- References:
- StartService with arguments
- From: Thomas Kehl
- Re: StartService with arguments
- From: Harvey Triana
- Re: StartService with arguments
- From: Thomas Kehl
- Re: StartService with arguments
- From: Mike D Sutton
- Re: StartService with arguments
- From: Thomas Kehl
- StartService with arguments
- Prev by Date: Re: StartService with arguments
- Next by Date: Re: vb netapi NT4 and W2K
- Previous by thread: Re: StartService with arguments
- Next by thread: Re: StartService with arguments
- Index(es):
Relevant Pages
|
|