AliCPM/Frm_Main.frm

204 lines
5.6 KiB
Plaintext

VERSION 5.00
Begin VB.Form Frm_Main
Caption = "阿里查排名"
ClientHeight = 8250
ClientLeft = 60
ClientTop = 345
ClientWidth = 6150
Icon = "Frm_Main.frx":0000
LinkTopic = "Form1"
ScaleHeight = 8250
ScaleWidth = 6150
StartUpPosition = 3 '窗口缺省
Begin VB.OptionButton Opt
Caption = "英文阿里"
Height = 180
Index = 1
Left = 2535
TabIndex = 13
Top = 2130
Width = 1080
End
Begin VB.OptionButton Opt
Caption = "中文阿里"
Height = 180
Index = 0
Left = 1365
TabIndex = 12
Top = 2130
Value = -1 'True
Width = 1080
End
Begin VB.TextBox pages
Height = 270
Left = 5385
TabIndex = 9
Text = "20"
Top = 2085
Width = 300
End
Begin VB.CommandButton CopyB
Caption = "复制结果"
Height = 450
Left = 3593
TabIndex = 8
Top = 2490
Width = 930
End
Begin VB.CommandButton clearb
Caption = "清除结果"
Height = 450
Left = 2603
TabIndex = 7
Top = 2490
Width = 930
End
Begin 英文阿里查排名.XmlHttp XmlHttp
Height = 240
Left = 12720
Top = 9225
Visible = 0 'False
Width = 240
_ExtentX = 423
_ExtentY = 423
End
Begin VB.CommandButton search
Caption = "开始查询"
Height = 450
Left = 1628
TabIndex = 4
Top = 2490
Width = 930
End
Begin VB.TextBox keys
Height = 1050
Left = 398
MultiLine = -1 'True
TabIndex = 3
Top = 930
Width = 5355
End
Begin VB.TextBox company
Height = 315
Left = 398
TabIndex = 2
Top = 315
Width = 5355
End
Begin VB.ListBox pagelist
Height = 4920
Left = 3878
TabIndex = 1
Top = 3075
Width = 1875
End
Begin VB.ListBox keylist
Height = 4920
Left = 398
TabIndex = 0
Top = 3075
Width = 3495
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "阿里版本: "
Height = 180
Left = 398
TabIndex = 11
Top = 2130
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "最大查找页数:"
Height = 180
Left = 4155
TabIndex = 10
Top = 2130
Width = 1170
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "关键词(用英文逗号隔开)"
Height = 180
Left = 2085
TabIndex = 6
Top = 690
Width = 1980
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "公司名称"
Height = 180
Left = 2715
TabIndex = 5
Top = 60
Width = 720
End
End
Attribute VB_Name = "Frm_Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub clearb_Click()
keylist.Clear
pagelist.Clear
End Sub
Private Sub CopyB_Click()
Dim result As String
Dim I As Long
For I = 0 To keylist.ListCount
If keylist.List(I) <> "" Then result = result + keylist.List(I) + vbTab + pagelist.List(I) + vbCrLf
Next
Clipboard.Clear
Clipboard.SetText result
End Sub
Private Sub keylist_Click()
pagelist.ListIndex = keylist.ListIndex
End Sub
Private Sub pagelist_Click()
keylist.ListIndex = pagelist.ListIndex
End Sub
Private Sub search_Click()
Dim key() As String
Dim I, j, nindex As Long
Dim Temp As String
Dim url As String
search.Enabled = False
key = Split(Replace(keys.Text, vbCrLf, ""), ",")
keylist.AddItem "============关键词============"
pagelist.AddItem "=======页数======="
For I = LBound(key) To UBound(key)
key(I) = Trim(key(I))
keylist.AddItem key(I)
nindex = keylist.ListCount - 1
For j = 1 To pages.Text
pagelist.List(nindex) = "查询第" & j & "页中..."
If Opt(1).Value = True Then
url = "http://www.alibaba.com/products/F0/" & key(I) & "/" & j & ".html"
Else
url = "http://s.1688.com/selloffer/offer_search.htm?keywords=" & key(I) & "&beginPage=" & j
End If
Temp = XmlHttp.GetData(url, ResponseBodyToText)
If InStr(1, Temp, company.Text) Then
pagelist.List(nindex) = "第" & j & "页": Exit For
Else
If j = pages Then pagelist.List(nindex) = "大于" & pages & "页"
End If
DoEvents
Next
DoEvents
Next
search.Enabled = True
End Sub