C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[17931] Re:DHCP 서버 주소알아내는법...?
유영인 [Chris] [] 2062 읽음    2002-04-25 13:13
레지스트리에서 다음과 같이 알아낼 수 있습니다.


String __fastcall TForm1::GetDHCPAddress()
{

String            stAddress, stInterfaceKey;
String            stMyKey = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
int               itInterfaces;

TRegistry *Registry = new TRegistry();
try {
   Registry->RootKey = HKEY_LOCAL_MACHINE;
   TStringList *InterfacesList = new TStringList;

   try {
     if(Registry->KeyExists(stMyKey)) {
        if(Registry->OpenKeyReadOnly(stMyKey)) {
          Registry->GetKeyNames(InterfacesList);
          Registry->CloseKey();

          for(itInterfaces = 0; itInterfaces < InterfacesList->Count; itInterfaces ++) {
            stInterfaceKey = stMyKey + InterfacesList->Strings[itInterfaces] + "\\";
            if(Registry->OpenKeyReadOnly(stInterfaceKey)) {
              stAddress = Registry->ReadString("DhcpNameServer");
              if(stAddress.Trim() == "") return(stAddress);
                                    else return("0.0.0.0");
             } else {
              return("0.0.0.0");
            }
          }
        }
      }
     } __finally {
      delete InterfacesList;
    }
  }
  __finally
  {
    delete Registry;
  }

return("0.0.0.0");

}


SkyWalker 님이 쓰신 글 :
: 안녕하세요 감사합니다.
:
: 제목그대로 DHCP 서버 주소를 알아내는 방법이 궁금합니다.
: 그럼 답변기다리겠습니다.

+ -

관련 글 리스트
17910 DHCP 서버 주소알아내는법...? SkyWalker 917 2002/04/24
17931     Re:DHCP 서버 주소알아내는법...? 유영인 [Chris] 2062 2002/04/25
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.