Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: Start a service with ShellExecute

1,351 views
Skip to first unread message

Martin

unread,
Aug 29, 2004, 11:19:55 PM8/29/04
to
ALL,

I am trying to start and stop a service "net stop w32time" and "net start
w32time" with the code below but failed to do so. Why why why? Any idea or
suggestions? Many thanks!!

================
NETIns_HINST :=ShellExecute(Handle, 'open', 'net stop w32time', nil, nil,
SW_SHOWNORMAL);
if NETIns_HINST <= 32 then
begin
Application.MessageBox(PChar('Error'#13#13'ShellExecute() = ' +
IntToStr(NETIns_HINST)), PChar(Application.Title), MB_ICONSTOP);
end;
================

Martin


David

unread,
Aug 30, 2004, 3:04:46 AM8/30/04
to
Martin, it should be:

ShellExecute(Handle, 'open', 'net.exe', 'start w32time', nil, 0);

and make sure w32time is the service name not the exe name.

David


"Martin" <martin...@austco.com> schreef in bericht news:4132...@newsgroups.borland.com...

Martin

unread,
Aug 30, 2004, 5:50:55 AM8/30/04
to
Thanks Dave, it works!!

Next question :)

Under Win2000 command prompt the auto yes pipe doesn't work? Is there a
trick??

c:\>echo Y| net time \\PC1 /set

Thanks!
Martin

"David" <hedel2[*removeme*]@zonnet.nl> wrote in message
news:4132d189$1...@newsgroups.borland.com...

Dale McKay

unread,
Aug 30, 2004, 11:36:54 AM8/30/04
to
net time \\PC1 /set /y

boual...@gmail.com

unread,
Mar 18, 2019, 1:14:50 PM3/18/19
to
Tankx men for the response, it works nicely
0 new messages