private sub form_load()
if isconnected = true then
msgbox (「您已經連通了inter***!」)
end if
if isconnected = false then
msgbox (「您還沒有連通 inter***!」)
end if
end sub
option explicit
/*有關的api宣告和定義*/
public declare function rasenumconnections lib 「rasapi32.dll」 alias 「rasenumconnectionsa」 (lprascon as any, lpcb as long, lpcconnections as long) as long
public declare function rasgetconnectstatus lib 「rasapi32.dll」 alias 「rasgetconnectstatusa」 (byval hrascon as long, lpstatus as any) as long
/*常數和變數的設定*/
public const ras95_maxentryname = 256
public const ras95_maxdevicetype = 16
public const ras95_maxdevicename = 32
public type rasconn95
dwsize as long
hrascon as long
szentryname(ras95_maxentryname) as byte
szdevicetype(ras95_maxdevicetype) as byte
szdevicename(ras95_maxdevicename) as byte
end type
public type rasconnstatus95
dwsize as long
rasconnstate as long
dwerror as long
szdevicetype(ras95_maxdevicetype) as byte
szdevicename(ras95_maxdevicename) as byte
end type
/*函式isconnected返回連通的狀態,如果為true則表示已連通*/
public function isconnected() as boolean
dim trascon(255) as rasconn95
dim lg as long
dim lpcon as long
dim retval as long
dim tstatus as rasconnstatus95
trascon(0).dwsize = 412
lg = 256 * trascon(0).dwsize
retval = rasenumconnections(trascon(0), lg, lpcon)
if retval <> 0 then
msgbox 「錯誤」
exit function
end if
tstatus.dwsize = 160
retval = rasgetconnectstatus(trascon(0)
.hrascon,tstatus)
if tstatus.rasconnstate = &h2000 then
isconnected = true
else
isconnected = false
end if
end function
VB6 連線MySql資料庫
目測 vb6 的資料比較少了,花了好久時間寫了個查詢語句 dim cn as newadodb.connection dim rs as newadodb.recordset 定義資料庫連線字串變數 dim strcn as string 定義資料庫連線引數變數 dim db host as str...
VB6中模擬按鈕的實現
朋友發來一個 vb6 的小要求 自行繪製按鈕,並且按鈕不能有控制代碼,不得用 image 控制元件,需要支援單擊事件,滑鼠移動上去會變化。感覺像個考試題啊!先貼 思路就是 使用 paintpicture 在窗體上作圖,使用mousemove事件判定滑鼠是否在的位置上,如果是則繪製滑鼠移動浮動後的,否...
VB6用API實現繁體簡體轉換
private declare function lcmapstring lib kernel32 alias lcmapstringa byval locale as long,byval dwmapflags as long,byval lpsrcstr as string,byval cchs...
VB6用API實現繁體簡體轉換
由於正好需要一個繁體轉簡體的事情,弄這個函式將就用一下了。private declare function lcmapstring lib kernel32 alias lcmapstringa byval locale as long,byval dwmapflags as long,byval ...
VB6連線PI實時資料庫
option explicit dim tagname as string 儲存單個工位號 dim tagpoint as long 儲存單個點源 dim apistate as long 儲存返回狀態 dim loginstate as long 儲存登入狀態 private sub cmdaut...