zhijun_chen
asked on
How can I disable the network card in delphi?
hello,
I want to disable the network card in delphi just as device manager do,how can I do it?
Hope for your answer.
I want to disable the network card in delphi just as device manager do,how can I do it?
Hope for your answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
8^)
ASKER
Thank u,RBertora
I am working on windows98,not NT,can u give a clue?
I am working on windows98,not NT,can u give a clue?
That might work on win98, run a search on your hard drive for file: win32.hlp
if its there then there is a chance it will work.
Meikl any ideas?
Rob ;-)
if its there then there is a chance it will work.
Meikl any ideas?
Rob ;-)
hi rob,
>Meikl any ideas?
I? no, I'm not very familar with set hardwareoptions by code, therefore i just look, to learn this. and in this case i've learned something from you ;-)
but i will examine the win-api, maybe i find a starting-point.
meikl
>Meikl any ideas?
I? no, I'm not very familar with set hardwareoptions by code, therefore i just look, to learn this. and in this case i've learned something from you ;-)
but i will examine the win-api, maybe i find a starting-point.
meikl
ASKER
thank u,
I have tried , It doesn't work on win98.
Any way, I will give u the points.
I have tried , It doesn't work on win98.
Any way, I will give u the points.
That would be very kind of you, but I feel bad taking 200 points off your account. So I suggest you don't do it.
But I wouldn't feel so bad taking 50pts if you don't mind Delete this question. Post another one for 50 I will cut&paste my suggestion in aagain...
your call.
Rob ;-)
But I wouldn't feel so bad taking 50pts if you don't mind Delete this question. Post another one for 50 I will cut&paste my suggestion in aagain...
your call.
Rob ;-)
Rob ;-)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, winsvc;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
var
Name : Pointer;
NameSize : DWord;
DeviceServiceHandle : THandle;
DeviceServiceSatus :TServiceStatus;
begin
NameSize := 100;
Name := allocmem(NameSize);
// a quick showmessage to see if you can find the service:
// If the showmessage is empty then you have not typed in a valid service name!
GetServiceKeyName(
OpenSCManager('PC-199',Nil
'3Com Etherlink III Adapter Driver',
Name,
NameSize);
showmessage(String(Name));
// get the service handle:
(*
SC_HANDLE OpenService(
SC_HANDLE hSCManager, // handle to service control manager database
LPCTSTR lpServiceName, // pointer to name of service to start
DWORD dwDesiredAccess // type of access to service
);
*)
DeviceServiceHandle := OpenService(
OpenSCManager('PC-199',Nil
'3Com Etherlink III Adapter Driver',
SERVICE_STOP);
// stop the service
ControlService(DeviceServi
SERVICE_CONTROL_STOP,Devic
(*
BOOL ControlService(
SC_HANDLE hService, // handle to service
DWORD dwControl, // control code
LPSERVICE_STATUS lpServiceStatus // pointer to service status structure
);
*)
end;
end.