谈Delphi下
谈Delphi下Internet的编程技巧(一) 作者:lyboy99
E-mail:lyboy99@sina.com
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"'''');
5.是否早想有个域名转换为IP地址的函数,现在我就给你一个
域名转换为IP地址:
function GetIPName(Name: string): string;
var
[1] [2] 下一页 [聊天工具]用Windows98第二版直接共享Internet [系统软件]Internet Explorer 编程简述(繁体版) [系统软件]单击链接后无法打开新的 Internet Explorer 窗口或… [系统软件]OLE with the internet explorer [常用软件]Internet Explorer 6 Public Preview 最新出击!! [常用软件]Internet Explorer中的潘多拉魔盒 作者:江海 [常用软件][网络]Becky Internet Mail 软件评测 [VB.NET程序]VB自动登陆网络站点详解(三):Internet Explore… [Delphi程序]DELPHI与INTERNET2 [Delphi程序]谈Delphi 下Internet 编程技巧(二)
|