打印本文 打印本文 关闭窗口 关闭窗口
delphi三十六之网络篇
作者:武汉SEO闵涛  文章来源:敏韬网  点击数880  更新时间:2009/4/23 18:24:40  文章录入:mintao  责任编辑:mintao
  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;

打印本文 打印本文 关闭窗口 关闭窗口