forward
global type n_adapters from nonvisualobject
end type
end forward
global type n_adapters from nonvisualobject
end type
global n_adapters n_adapters
type prototypes
Function ulong GetLastError( &
) Library "kernel32.dll"
Function ulong FormatMessage( &
ulong dwFlags, &
ulong lpSource, &
ulong dwMessageId, &
ulong dwLanguageId, &
Ref string lpBuffer, &
ulong nSize, &
ulong Arguments &
) Library "kernel32.dll" Alias For "FormatMessageA"
Function ulong GetAdaptersInfo ( &
Ref IP_ADAPTER_INFO pAdapterInfo[], &
Ref ulong pOutBufLen &
) Library "iphlpapi.dll" Alias For "GetAdaptersInfo"
Subroutine CopyMemory ( &
Ref blob Destination, &
long Source[], &
long Length &
) Library "kernel32.dll" Alias For "RtlMoveMemory"
Subroutine CopyMemory ( &
Ref integer Destination, &
blob Source, &
long Length &
) Library "kernel32.dll" Alias For "RtlMoveMemory"
end prototypes
forward prototypes
public function string of_getlasterror ()
public function string of_nbr2hex (unsignedlong aul_number, integer ai_digit)
public function boolean of_getadaptersinfo (ref string as_macaddress[], ref string as_description[], ref string as_adaptername[], ref string as_ipaddress[])
public function string of_getaddr ()
end prototypes
public function string of_getlasterror ();// SCRIPT: n_adapters.of_GetLastError
//
// PURPOSE: This function returns the last Windows API error.
//
// RETURN: Error message text
//
// -----------------------------------------------------------------------------
Constant ULong FORMAT_MESSAGE_FROM_SYSTEM = 4096
Constant ULong LANG_NEUTRAL = 0
String ls_buffer, ls_errmsg
ULong lul_error
lul_error = GetLastError()
ls_buffer = Space(255)
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, &
lul_error, LANG_NEUTRAL, ls_buffer, 255, 0)
ls_errmsg = "Error# " + String(lul_error) + "~r~n~r~n" + ls_buffer
Return ls_errmsg
end function
public function string of_nbr2hex (unsignedlong aul_number, integer ai_digit);// SCRIPT: n_adapters.of_Nbr2Hex
//
// PURPOSE: This function converts a number to a hex string.
//
// ARGUMENTS: aul_number - A number to convert
// ai_digit - The number of hex digits expected
//
// RETURN: Hex string
//
// -----------------------------------------------------------------------------
ULong lul_temp0, lul_temp1
Char lc_ret
If ai_digit > 0 Then
lul_temp0 = Abs(aul_number / (16 ^ (ai_digit - 1)))
lul_temp1 = lul_temp0 * (16 ^ (ai_digit - 1))
If lul_temp0 > 9 Then
lc_ret = Char(lul_temp0 + 55)
Else
lc_ret = Char(lul_temp0 + 48)
End If
Return lc_ret + of_Nbr2Hex(aul_number - lul_temp1, ai_digit - 1)
End If
Return ""
end function
public function boolean of_getadaptersinfo (ref string as_macaddress[], ref string as_description[], ref string as_adaptername[], ref string as_ipaddress[]);// SCRIPT: n_adapters.of_GetAdaptersInfo
//
// PURPOSE: This function returns information about network adapters.
//
// ARGUMENTS: as_macaddress - Array of MAC addresses
// as_description - Array of Descriptions
// as_adaptername - Array of Adapter names
// as_ipaddress - Array of IP addresses
//
// -----------------------------------------------------------------------------
Constant ULong ERROR_SUCCESS = 0
Constant ULong ERROR_BUFFER_OVERFLOW = 111
IP_ADAPTER_INFO lstr_Adapter[]
ULong lul_OutBufLen
Integer li_idx, li_max, li_macidx, li_macmax, li_byte
Blob lblob_address
详细解决方案
pb 获取ip地址解决方案
热度:95 发布时间:2016-04-29 05:50:25.0
相关解决方案
- xml/xslt 变量自增。解决方案
- DB2 调用java自定义方法报错,请大牛帮忙~解决方案
- 关于request.getParameterValues()解决方案
- 一个JSP页面,在NETBEANS里报错!解决方案
- WEB环境javamail取不到pop3邮件,解决方案
- 急来者有分,晚了就没了!解决方案
- disable在IE8中可以接收焦点了?解决方案
- 求网页采集器的正则表达式。解决方案
- 关于FckEdit。解决方案
- 在Struts2 如果有多个拦截器栈顺序写错会有什么不同?解决方案
- servlet+jquery1.4.2(ajax error?)解决方案
- 关于el 《c:if》。解决方案
- jsp、taglib、velocity、freemarker等都过时了吗?解决方案
- 有开发过CA认证的朋友,帮个忙!解决方案
- com.microsoft.sqlserver.jdbc.SQLServerException: 列名 n_id 无效。解决方案
- java 缓冲区读写操作,求解?解决方案
- EXTJS中treepanel树内部机制?解决方案
- 一个数学题,求个算法。解决方案
- java 大文件上传?解决方案
- 从JSP中得到访问者的真实IP(很急)!解决方案
- 高分求解!解决方案
- java可以跟PHP对接吗?解决方案
- 有什么办法在JSP页面在不使用<%%>情况下 使用数学函数Math.floor()解决方案
- 在JSP页面调用JavaBean,出错!初学!求指导!解决方案
- 简单的更改记录的语句?解决方案
- JS方法内取的值是false,给方法传递的值却是正确的,请高手指教。解决方案
- 求教各位大神,初学JSP看什么书比较好呢?新一点的。解决方案
- java调用so,解决方案
- MyEclipse怎样运行applet程序?解决方案
- JPA到底是神马?解决方案