摘要载入中… 请稍等…
内容载入中… 请稍等…
| ◎→ | 本类最新 |
|
远程程序运行状态的简单监控 在IE上增添一个按钮 在Delphi中实现ASP编程 在Delphi程序中应用IE浏览器控件 在DELPHI程序中拨号上网 用Delphi编写ASP的ActiveX服务器 用Delphi编写CGI程序返回图象 |
|
| ◎→相关资源 | |
| C语言入门视频教程 C#编程WinForm入门视频 Asp.net入门视频教程下载 VC++编程视频教程下载 VB窗体文章 HTML入门教程 Deiphi实例教程 Deiphi窗体文章 Deiphi数据库编程 Deiphi网络编程 Deiphi图形图象文章 Deiphi系统文件 | |
| ◎→ | 热门资源 |
| 九赢广告联盟的优点和缺点 通过IP反查域名 用VB的Printer对象编写打印程序 AfxMessageBox参数详解 顶级黑客年收入超千万元! Intel和AMD价格激战即将开打 iPhone运行Apache网络服务 |
|
网上有很多关于用DELPHI来建立IIS的虚拟目录的例子,但都是需要加载类库,我这里则采用写注册表的方式来实现,方法简单,主要是不需要加入类的复杂过程,唯一的不同是需要重启电脑后才能生效。代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
RegODBC:TRegistry;
registerTemp : TRegistry;
SysPath: array [0..255] of char;
begin
RegODBC:=TRegistry.create; //访问注册表
RegODBC.RootKey:=HKEY_LOCAL_MACHINE;
RegODBC.OpenKey('\SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots',True);
getsystemdirectory(SysPath,255);
if regodbc.ValueExists('/fire') then
begin
suimessage1.Text:='本机WEB已存在名为fire的虚拟目录。'+#13#10+'请将此fire删除或重命名。';
suimessage1.IconType:=suistop;
suimessage1.ButtonCount:=1;
suimessage1.Caption:='错误';
if suimessage1.ShowModal=mrok then
winexec(pchar(SysPath+'\inetsrv\inetmgr.exe'),sw_shownormal);
exit;
end
else
begin
registerTemp := TRegistry.Create; //建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_LOCAL_MACHINE;//设置根键值为HKEY_LOCAL_MACHINE
//找到或创建\SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots,写入IIS配置信息
if OpenKey('\SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots',True) then
begin
WriteString('/fire','E:\fire,,205');
end
else//创建键值失败
begin
suimessage1.Text:='IIS配置失败,本程序即将关闭。'+#13#10+'关闭后请先检查Internet服务管理器,排除错误或安装后再运行本程序。';
suimessage1.IconType:=suistop;
suimessage1.ButtonCount:=1;
suimessage1.Caption:='错误';
if suimessage1.ShowModal=mrok then
application.Terminate ;
end;
CloseKey;
Free;
end;
end;
RegODBC.Free;
end;
| 芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们 |