黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图
您现在的位置: 黑客风云 >> 黑客文章 >> 黑客进阶 >> 黑客编程 >> 文章正文
[推荐]Delphi下Internet的编程技巧
      ★★★★★
Delphi下Internet的编程技巧
文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2006-11-20

Delphi带了很多的Internet应用编程控件,这使得我们开发Internet的应用程序可以轻松些,下面我将逐步介绍一些关于Internet下应用程序编程技巧,这些技巧都是一些细微的方面,但是它却可以给你的应用程序添加重要的功能,将使你开发Internet下的应用程序事半功倍。

说过开场旁白后,首先介绍:设置系统默认浏览器和系统默认电子邮件收发软件。

1.获得默认的internet浏览器地址函数:

下面的函数是通过读取注册表的设置后,得到默认Internet的浏览器所在地址
function GetDefaultShellHTTP : string;
var
reg : TRegistry;
begin
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_CLASSES_ROOT;
  if Reg.KeyExists(’http\shell\open\command’) then
  begin
    Reg.OpenKey(’http\shell\open\command’,false);
    Result:=Reg.ReadString(’’);
  end
  else
    Result:=’’;
  Reg.Free;
end;

2.设置internet浏览器
procedure SetDefaultShellHttp(CmdLine : string);
var
reg : TRegistry;
begin
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_CLASSES_ROOT; //注册表的地址:
  Reg.OpenKey(’http\shell\open\command’,true);//注册表的地址:
  Reg.WriteString(’’,CmdLine);
  Reg.Free;
end;
setDefaultshellhttp(’"C:\PROGRA~1\INTERN~1\iexplorer.exe" -nohome’);

3.获得和设置默认的E-Mail 收发软件的函数
下面的函数是通过读取注册表的设置后,得到默认E-mail收发软件所在地址
function GetDefaultMail : string;
var
reg : TRegistry;
 
begin
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_CLASSES_ROOT;
  if Reg.KeyExists(’Mailto\shell\open\command’) then
  begin
    Reg.OpenKey(’Mailto\shell\open\command’,false);
    Result:=Reg.ReadString(’’);
  end
  else
    Result:=’’;
  Reg.Free;
end;

4.设置默认邮件箱
procedure SetDefaultMail(CmdLine : string);
var
reg : TRegistry;
 
begin
  Reg:=TRegistry.Create;
  Reg.RootKey:=HKEY_CLASSES_ROOT;
  Reg.OpenKey(’Mailto\shell\open\command’,true);
  Reg.WriteString(’’,CmdLine);
  Reg.Free;
end;
使用
//SetDefaultMail(’E:\FoxMail\FoxMail.exe -T "%1" -S "%2"’);

[1] [2] 下一页  

文章录入:cainiaowang    责任编辑:cainiaowang 
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
VIP 专 区
Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
ICP备案:冀06009886