Delphi基础开发技巧

豆豆网   技术应用频道   2007年07月23日  【字号: 收藏本文

内容摘要:本文介绍Delphi基础开发的一些技巧

if InetIsOffline(0) then ShowMessage('not connected!')
else ShowMessage('connected!');

  该函数返回TRUE如果本地系统没有连接到INTERNET。

  附:

  大多数装有IE或OFFICE97的系统都有此DLL可供调用。

InetIsOffline
BOOL InetIsOffline(
DWORD dwFlags,
);

  [DELPHI]简单地播放和暂停WAV文件

uses mmsystem;
function PlayWav(const FileName: string): Boolean;
begin
Result := PlaySound(PChar(FileName), 0, SND_ASYNC);
end;
procedure StopWav;
var
buffer: array[0..2] of char;
begin
buffer[0] := #0;
PlaySound(Buffer, 0, SND_PURGE);
end;

  [DELPHI]取机器BIOS信息

with Memo1.Lines do
begin
Add('MainBoardBiosName:'+^I+string(Pchar(Ptr($FE061))));
Add('MainBoardBiosCopyRight:'+^I+string(Pchar(Ptr($FE091))));
Add('MainBoardBiosDate:'+^I+string(Pchar(Ptr($FFFF5))));
Add('MainBoardBiosSerialNo:'+^I+string(Pchar(Ptr($FEC71))));
end;

  [DELPHI]网络下载文件

uses UrlMon;
function DownloadFile(Source, Dest: string): Boolean;
begin
try
Result := UrlDownloadToFile(nil, PChar(source), PChar(Dest), 0, nil) = 0;
except
Result := False;
end;
end;
if DownloadFile('http://www.borland.com/delphi6.zip, 'c:kylix.zip') then
ShowMessage('Download succesful')
else ShowMessage('Download unsuccesful')

  [DELPHI]解析服务器IP地址

责编:豆豆技术应用

正在加载评论...