본문 바로가기

Visual Basic4

[API]Computer name 가져오기 선언) Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long 설명) 위의 함수는 buffer 에다 computer name 을 저장해주고 성공하면 0이 아닌 값을, 실패하면 0을 반환합니다. 그리고 버퍼에 computer name 이 아닌 값들이 들어가는데 이를 제거하기 위해 replace 함수를 써서 Chr(0) 인 값을 "" 로 바꿔주는게 좋습니다. 예) Dim strComputerName As String * 255 Dim lngReturn As Long lngReturn = GetComputerName(strCompu.. 2009. 1. 16.
[API]Network drive 끊기 선언) Public Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" _ (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long Public Const NO_ERROR = 0 Public Const CONNECT_UPDATE_PROFILE = &H1 설명) Windows 95 버전 이상에서 사용할 수 있습니다. 위의 API 함수를 먼저 선언해주어야 하며, 파라미터의 설명은 다음과 같습니다. lpName : network drive name. 현재 매핑되어있는 네트워크 드라이브의 경로로 예로 W: 같은 것입니다. dwFlag.. 2009. 1. 16.
[API]Network drive 연결하기 선언) Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" _ (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long NETRESOURCE 구조체 선언) Public Type NETRESOURCE dwScope As Long dwType As Long dwDisplayType As Long dwUsage As Long lpLocalName As String lpRemoteName As String lpComment As String lpProvider .. 2009. 1. 16.
[API]Domain 과 User name 가져오기. Domain/Computer name 과 user name 을 가져오는 API 입니다. 이 API 의 설명은 다음과 같습니다. The GetUserNameEx function retrieves the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name. 해석) GetUserNameEx 함수는 사용자 이름이나 호출하는 thread 와 관련있는 다른 보안 주체를 가져온다. 그리고 반환되는 이름의 형식을 지정할 수가 있다. 라고 되어있는데, 다른 보안 주체라는 것이 예를 들어 client 가 특정 network domain 에 묶여있.. 2009. 1. 16.