📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00808000&
BorderStyle = 1 'Fixed Single
Caption = "获取URL中的组成要素"
ClientHeight = 5160
ClientLeft = 45
ClientTop = 330
ClientWidth = 7140
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5160
ScaleWidth = 7140
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "运行(&R)"
Height = 495
Left = 5520
TabIndex = 22
Top = 4320
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
Index = 6
Left = 3960
TabIndex = 13
Text = "Text3"
Top = 3840
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Index = 5
Left = 3960
TabIndex = 12
Text = "Text3"
Top = 3360
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Index = 4
Left = 3960
TabIndex = 11
Text = "Text3"
Top = 2880
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Index = 3
Left = 3960
TabIndex = 10
Text = "Text3"
Top = 2400
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Index = 2
Left = 3960
TabIndex = 9
Text = "Text3"
Top = 1920
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Index = 1
Left = 3960
TabIndex = 8
Text = "Text3"
Top = 1440
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 6
Left = 1080
TabIndex = 7
Text = "Text2"
Top = 3840
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 5
Left = 1080
TabIndex = 6
Text = "Text2"
Top = 3360
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 4
Left = 1080
TabIndex = 5
Text = "Text2"
Top = 2880
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 3
Left = 1080
TabIndex = 4
Text = "Text2"
Top = 2400
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 2
Left = 1080
TabIndex = 3
Text = "Text2"
Top = 1920
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Index = 1
Left = 1080
TabIndex = 2
Text = "Text2"
Top = 1440
Width = 2775
End
Begin VB.TextBox Text1
Height = 735
Left = 1080
MultiLine = -1 'True
TabIndex = 0
Text = "Form1.frx":030A
Top = 240
Width = 5535
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "dwFlag=KEEPSCHEME"
ForeColor = &H00FFFFFF&
Height = 180
Left = 4200
TabIndex = 21
Top = 1200
Width = 1530
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "dwFlag=0&&"
ForeColor = &H00FFFFFF&
Height = 180
Left = 1560
TabIndex = 20
Top = 1200
Width = 810
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "查询参数"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 19
Top = 3960
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "端口"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 18
Top = 3480
Width = 360
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 17
Top = 3000
Width = 360
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 16
Top = 2520
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "主机名"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 15
Top = 2040
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "SCHEME"
ForeColor = &H00FFFFFF&
Height = 180
Left = 240
TabIndex = 14
Top = 1560
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "源URL"
ForeColor = &H00FFFFFF&
Height = 180
Left = 360
TabIndex = 1
Top = 360
Width = 450
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 Sub Command1_Click()
Dim sPart As String
Dim sUrl As String
Dim cnt As Long
'以文本框Text1中的内容作为函数调用的参数,
'并分别设置其标志为0&和Keepscheme
For cnt = 1 To 6
sUrl = Text1.Text
sPart = GetUrlParts(sUrl, cnt, 0&)
Text2(cnt).Text = sPart
Next
For cnt = 1 To 6
sUrl = Text1.Text
sPart = GetUrlParts(sUrl, cnt, URL_PARTFLAG_KEEPSCHEME)
Text3(cnt).Text = sPart
Next
End Sub
Private Sub Form_Load()
Dim cnt As Long
Text1.Text = "http://ready:password" & _
"@www.microsoft.com:8080" & _
"/msdn/index.html?" & _
"code/network/netconnect.htm"
'初始化控件
For cnt = 1 To 6
Text2(cnt).Text = ""
Text3(cnt).Text = ""
Next
End Sub
Private Function GetUrlParts(ByVal sUrl As String, _
dwPart As Long, _
dwFlags As Long) As String
Dim sPart As String
Dim dwSize As Long
If Len(sUrl) > 0 Then
sPart = Space$(MAX_PATH)
dwSize = Len(sPart)
If UrlGetPart(sUrl, _
sPart, _
dwSize, _
dwPart, _
dwFlags) = ERROR_SUCCESS Then
GetUrlParts = Left$(sPart, dwSize)
End If 'If UrlGetPart
End If 'If Len(sUrl) > 0
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -