1.在程序中实现用默认的Web浏览器打开URL以及发送电子邮件
uses
shellapi;
….
Procedure TForm1.Label1Click(Sender:Tobject);
begin
shellexecute(handle,"open","http://www.swissdelphicenter.ch", nil,nil,sw_show);
end;
procedure
TForm1.Button1Click(Sender: Tobject);
begin
shellexecute(handle,"open", "mailto:user@host.com", nil, nil,sw_shownormal);
end;
2.得到网络适配器的MAC地址
//uses Windows, SysUtils, NB30, 以下为类型定义及函数代码
const sNetBiosError = "NetBIOS错误%d";
type TMACAddress = packed array[0..5] of Byte;
ENetBiosError = class( Exception );
TAStat = record Adapt : TAdapterStatus;
NameBuff : array[0..30] of TNameBuffer;
end;
function GetMacAddress( AdapterNum : Integer ) : TMACAddress;
var
Ncb : TNCB; uRetCode : Char;
J : Integer; Adapter : TAStat;
begin
FillChar( NCB, SizeOf(NCB), 0 );
with NCB do begin
ncb_command := Char(NCBRESET);
ncb_lana_num := Char( AdapterNum );
end; 更多内容请看网络故障手册 网络管理实用手册 网络建设专题,或 uRetCode := Netbios( @Ncb );
if uRetCode $#@60;$#@62; #0 then raise Exception.CreateFmt( sNetBIOSError, [Ord(uRetCode)]
);
FillChar( NCB, SizeOf(NCB), 0 );
with NCB do begin
ncb_command := Char(NCBASTAT);
ncb_lana_num := Char( AdapterNum );
上一篇:Delphi数据库控件使用入门
下一篇:Delphi面向对象编程的20条规则
|