[VB6] 시스템 변수 읽어오기
현 OS와 어떤 것들이 추가적으로 설치가 되어 있느냐에 따라 값이 없을 수도 있는 듯 합니다. 아래 파랑색 글씨처럼 괄호 안에 숫자를 넣을 수도 있고 직접 찾고싶은 내용을 넣어도 됩니다. 예) 컴퓨터 이름을 알고 싶을땐 Environ(5) = Environ(COMPUTERNAME) 예제 환경은 VB6 + SP5 + Win 2000 Server 입니다. [예제] Private Sub Command1_Click() Dim Indx As Integer
Indx = 1 ' 1로 인덱스를 초기화합니다.
Do Debug.Print "[" & Indx & "]" & Environ(Indx) Indx = Indx + 1 Loop Until Environ(Indx) = "" End Sub [결과] [1]ALLUSERSPROFILE=E:\Documents and Settings\All Users.WINNT [2]APPDATA=E:\Documents and Settings\Administrator.KWMOUSE7\Application Data [3]CI_HOLOS_CLI=E:\Program Files\Seagate Software\Open OLAP [4]CommonProgramFiles=E:\Program Files\Common Files [5]COMPUTERNAME=KWMOUSE7 [6]ComSpec=E:\WINNT\system32\cmd.exe [7]HOMEDRIVE=E: [8]HOMEPATH=\Documents and Settings\Administrator.KWMOUSE7 [9]HPCProEmulDir=E:\Windows CE Tools\wce211\MS HPC Pro\emulation [10]INCLUDE=E:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\ [11]LIB=E:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\ [12]LOGONSERVER=\\KWMOUSE7 [13]NUMBER_OF_PROCESSORS=1 [14]OS=Windows_NT [15]Os2LibPath=E:\WINNT\system32\os2\dll; [16]Path=E:\WINNT\system32;E:\WINNT;E:\WINNT\System32\Wbem;E:\Program Files\Microsoft SQL Server\80\Tools\BINN;"";C:\PROGRA~1\MICROS~2\80\TOOLS\BINN; [17]PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH [18]PROCESSOR_ARCHITECTURE=x86 [19]PROCESSOR_IDENTIFIER=x86 Family 15 Model 1 Stepping 2, GenuineIntel [20]PROCESSOR_LEVEL=15 [21]PROCESSOR_REVISION=0102 [22]ProgramFiles=E:\Program Files [23]SSCEINSTDIR=E:\Program Files\Microsoft SQL Server CE 2.0\ [24]SystemDrive=E: [25]SystemRoot=E:\WINNT [26]TEMP=E:\DOCUME~1\ADMINI~1.KWM\LOCALS~1\Temp [27]TMP=E:\DOCUME~1\ADMINI~1.KWM\LOCALS~1\Temp [28]USERDOMAIN=KWMOUSE7 [29]USERNAME=Administrator [30]USERPROFILE=E:\Documents and Settings\Administrator.KWMOUSE7 [31]VS71COMNTOOLS=E:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\ [32]windir=E:\WINNT [33]WWPCEmulDir=E:\Windows CE Tools\wce211\MS Palm Size PC\emulation |
http://www.devpia.com/forum/BoardView.aspx?no=2914&page=3&Tpage=34&forumname=vb_lec&stype=&ctType=&answer=