Article View: borland.public.cppbuilder.nativeapi
Article #15085Re: Stop and startng a service
From: Remy Lebeau (TeamB)
Date: Sat, 19 Jul 2003 22:08
Date: Sat, 19 Jul 2003 22:08
40 lines
2612 bytes
2612 bytes
"Max Topley" <mtj2@btopenworld.com> wrote in message
news:4caihvg5448aj8mmrm0mst9e6tqr8nhv77@4ax.com...
> You consider undocumented classes of unknown provenance
> easier to use than API functions covered in the Windows SDK?
If well-written, then yes, absolutely. There is a ***huge*** secondary
market of third-party code for extending IDE's and writing API code easier.
Why do you think frameworks exist in the first place? Direct API
programming can be quite ugly at times. If someone decides to write a class
that wraps the low-level details and can turn a lot of API code into a few
lines of user code, so much the better. Case in point:
--- API ---
SC_HANDLE schService, schSCManager;
SERVICE_STATUS ssStatus;
schSCManager = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS);
schService = OpenService( schSCManager, TEXT( "ServiceName"),
SERVICE_STOP);
if( schService != NULL )
ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus);
vs.
--- TServiceControlManager ---
TServiceControlManager mgr(NULL, "ServiceName");
mgr.stop(5000);
Now granted, sometimes such wrapper code can be more complex internally then
using the original API code directly. But that is the point with OOP. It
sometimes sacrifices optimization for usability and efficiency. Things can
always be optimized later on, though.
Gambit
Technical Details
Message-ID:
<3f19c023$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <u2aghv8tni72mu5urk55c6pcfhlbqgi0s4@4ax.com> <3f184dcc@newsgroups.borland.com> <4caihvg5448aj8mmrm0mst9e6tqr8nhv77@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,80e98d9661a7c48a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-19 15:12:09 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f163941$1@newsgroups.borland.com> <mdhchv8i6dsqrsemn6heka3sk41uj4cckg@4ax.com> <rghchv4m3v4qqrv0uqpg359inhsjm8i4kv@4ax.com> <u2aghv8tni72mu5urk55c6pcfhlbqgi0s4@4ax.com> <3f184dcc@newsgroups.borland.com> <4caihvg5448aj8mmrm0mst9e6tqr8nhv77@4ax.com> Subject: Re: Stop and startng a service Date: Sat, 19 Jul 2003 15:08:36 -0700 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f19c023$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1058652195 207.175.226.26 (19 Jul 2003 15:03:15 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail