인터넷에는 델파이를 사용하여 IIS의 가상 디렉토리를 설정하는 데 많은 예가 있지만, 클래스 라이브러리를로드하여 레지스트리를 작성하는 방법이 간단합니다. 클래스를 추가하려면 차이점은 컴퓨터가 적용되기 전에 컴퓨터를 다시 시작해야한다는 것입니다. 코드는 다음과 같습니다.
절차 tform1.Button1click (sender : tobject);
var
RegoDBC : Tregistry;
RegisterTemp : Tregistry;
Syspath : char의 배열 [0..255];
시작하다
regodbc : = tregistry.create; // 레지스트리에 액세스하십시오
regodbc.rootkey : = hkey_local_machine;
regodbc.openkey ( '/system/controlset001/services/w3svc/parameters/virtual roots', true);
getSystemDirectory (Syspath, 255);
regodbc.valueexists ( '/fire') 인 경우
시작하다
suimessage1.text : = '기본 웹에는 이미 Fire라는 가상 디렉토리가 있습니다. '+#13#10+'이 불의 이름을 삭제하거나 바꾸십시오. ';;
suimessage1.icontype : = suitop;
Suimessage1.ButtonCount : = 1;
Suimessage1.caption : = '오류';
suimessage1.showmodal = mrok라면
Winexec (pchar (syspath+'/inetsrv/inetmgr.exe'), sw_shownormal);
출구;
끝
또 다른
시작하다
registertemp : = tregistry.create; // 레지스트리 인스턴스를 만듭니다
RegisterTemp와 함께
시작하다
루트 키 : = hkey_local_machine; // 루트 키 값을 hkey_local_machine으로 설정합니다
///system/controlset001/services/w3SVC/매개 변수/가상 루츠를 찾거나 생성하십시오. IIS 구성 정보를 작성하십시오
OpenKey ( '/System/ControlSet001/Services/W3SVC/Parameters/Virtual Roots', True 인 경우)
시작하다
Writestring ( '/fire', 'e :/fire ,, 205');
끝
else // 키 값을 만듭니다
시작하다
suimessage1.text : = 'IIS 구성이 실패 했으며이 프로그램은 곧 마감됩니다. '+#13#10+'마감 후 인터넷 서비스 관리자를 먼저 확인 하거나이 프로그램을 실행하기 전에 오류를 해결하거나 설치하십시오. ';;
suimessage1.icontype : = suitop;
Suimessage1.ButtonCount : = 1;
Suimessage1.caption : = '오류';
suimessage1.showmodal = mrok라면
응용 프로그램.
끝;
Closekey;
무료;
끝;
끝;
regodbc.free;
끝;
참고 : Suipack4 컨트롤의 Suimessagedialog 구성 요소는 코드에서 사용됩니다. 관심이 있으시면 저에게 연락하십시오. [email protected] QQ : 49055028