If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Working with Windows Services using Delphi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-16-04, 06:23
m.inckle m.inckle is offline
Registered User
 
Join Date: Feb 2004
Posts: 24
Working with Windows Services using Delphi

I have two computers networked to each other - computer A and computer B.

Computer A has a Windows Service on called 'svcItextIt1'

My aim is to write a program for Computer B, to look at Computer A and see if it has the service installed correctly.

If a put my program on computer A it works fine with the machine name set as :
Machine Name: Blank
I.P Address
sSkills3 (name of computer)

but, no matter what I set machine name to ( I.P address or computer A name ), the service is not being recognised when I run the program on computer B.

Is this possible to do? Could it a network problem?

Please can anyone help or advise me


The code I am using is below


procedure TfrmServiceStatus.btnOKClick(Sender: TObject);
begin
machinename := edit1.text;
servicename := 'svcItextIt1';

if serviceexists(machinename,servicename) then
begin
showmessage('svcItextIt1 DOES exist');
end
else
begin
showmessage('svcItextIt1 DOES NOT exist');
end;
end;

function TfrmServiceStatus.serviceExists(smachine,Sservice: string):boolean;
var
schm,
schs : SC_Handle;

begin
schm := OpenSCManager(PChar(sMachine),
Nil, SC_MANAGER_CONNECT);

if (schm <>0) then
schs := OpenService(schm,
PChar(sService), SERVICE_ALL_ACCESS);

result:= (schs<>0);
end;

Last edited by m.inckle; 07-16-04 at 06:45.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On