?? form1.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "根據Internet的連接狀態,自動啟動IE瀏覽器"
ClientHeight = 2595
ClientLeft = 60
ClientTop = 345
ClientWidth = 5295
LinkTopic = "Form1"
ScaleHeight = 2595
ScaleWidth = 5295
StartUpPosition = 1 '所有者中心
Begin VB.Timer Timer1
Interval = 800
Left = 270
Top = 1800
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 540
Left = 1890
TabIndex = 1
Top = 1740
Width = 1410
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "www.mingrisoft.com"
Height = 435
Left = 510
TabIndex = 2
Top = 1020
Width = 4305
End
Begin VB.Label Label1
Alignment = 2 'Center
Height = 435
Left = 510
TabIndex = 0
Top = 480
Width = 4305
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function RasEnumConnections Lib "RasApi32.dll" Alias _
"RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, _
lpcConnections As Long) As Long
Private Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias _
"RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
Const SW_SHOW = 5
Const RAS95_MaxEntryName = 256
Const RAS95_MaxDeviceType = 16
Const RAS95_MaxDeviceName = 32
Private Type RASCONNSTATUS95
dwSize As Long
RasConnState As Long
dwError As Long
szDeviceType(RAS95_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Private 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
Private Sub Timer1_Timer() '根據Internet鏈接狀態,啟動ie瀏覽器
Dim TRasCon(255) As RASCONN95
Dim lg As Long
Dim lp As Long
Dim RetVal As Long
Dim status As RASCONNSTATUS95
TRasCon(0).dwSize = 412
lg = 256 * TRasCon(0).dwSize
RetVal = RasEnumConnections(TRasCon(0), lg, lp)
If RetVal <> 0 Then '如果沒有撥號連接
Exit Sub
End If
status.dwSize = 160
RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, status)
If status.RasConnState = &H2000 Then '如果已經鏈接Internet
ShellExecute 0&, vbNullString, Label2.Caption, vbNullString, vbNullString, 0 '調用ie
Else
Label1.Caption = "未連接Internet!"
End If
End Sub
Private Sub Command1_Click()
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -