獲取本機所有的ADSL連線名稱

2021-06-01 12:10:53 字數 1562 閱讀 6620

真鬱悶呀,就這點**,費半天勁,dotras怎麼會沒有這個功能呢?

dotras的就只有乙個獲取dotras.rasconnection.getactiveconnections這應該是活動連線

'呼叫方法

dim stradsl as string = ras.listadsl()

if stradsl <> "" then

dim arr() as string = split(stradsl, "|")

for i as integer = 1 to ubound(arr)

comboboxadsl.items.add(arr(i))

next i

if comboboxadsl.items.count > 0 then comboboxadsl.selectedindex = 0

end if

'以下部分放到類中

imports system.runtime.interopservices

imports system.text

public class ras

_private structure rasentryname

dim dwsize as integer

_dim szentryname as string

dim flags as integer

_dim szphonebookpath as string

end structure

private declare auto function rasenumentries lib "rasapi32.dll" ( _

byval reserved as string, _

byval phonebook as string, _

<[in](), out()> byval rasentrynames() as rasentryname, _

byref cntbytes as integer, _

byref cntentries as integer _

) as integer

public shared function listadsl() as string

dim tmpadsl as string = ""

dim lngrtn as long

dim entrycnt as long

dim entry(255) as rasentryname

entry(0).dwsize = marshal.sizeof(gettype(rasentryname))

lngrtn = rasenumentries(vbnullstring, vbnullstring, entry, entry(0).dwsize * 255, entrycnt)

dim i as long

for i = 0 to entrycnt - 1

tmpadsl = tmpadsl & "|" & entry(i).szentryname

next i

listadsl = tmpadsl

end function

end class

獲取本機SqlServer名稱

using system.data.sql 檢索包含有關可用sql server例項的資訊的表,必須先使用共享 靜態instance屬性來檢索列舉器 sqldatasourceenumerator instance sqldatasourceenumerator.instance 呼叫 getdat...

C 獲取Excel中所有的Sheet名稱

注意 自己試了一下下面的方法,稍微改變了一下,一直都報錯,後來發現問題在於 自己習慣了陣列等集合的索引都是從0開始,而excel中都是從1開始的。這一點,下面的 中有體現。原文連線 獲取第乙個sheet excel.worksheet sheet excel.worksheet mybook.she...

QT 獲取本機所有IP

qt 獲取本機所有ip include include include bool islanip uint ip 127.x.x.x給本機位址使用 224.x.x.x為多播位址段 255.255.255.255為通用的廣播位址 10.x.x.x,172.16.x.x和192.168.x.x供本地網使...