home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cddbco2a / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-13  |  10.8 KB  |  353 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
  4. Begin VB.Form CCDid 
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   8190
  7.    ClientLeft      =   1620
  8.    ClientTop       =   1545
  9.    ClientWidth     =   11295
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8190
  12.    ScaleWidth      =   11295
  13.    Begin VB.CommandButton Command4 
  14.       Caption         =   "CDDB STATS"
  15.       Height          =   375
  16.       Left            =   7920
  17.       TabIndex        =   21
  18.       Top             =   6960
  19.       Width           =   1455
  20.    End
  21.    Begin VB.CommandButton Command3 
  22.       Caption         =   "CDDB HELP"
  23.       Height          =   375
  24.       Left            =   7920
  25.       TabIndex        =   20
  26.       Top             =   6480
  27.       Width           =   1455
  28.    End
  29.    Begin VB.CommandButton Command2 
  30.       Caption         =   "CDDB SITES"
  31.       Height          =   375
  32.       Left            =   7920
  33.       TabIndex        =   19
  34.       Top             =   6000
  35.       Width           =   1455
  36.    End
  37.    Begin InetCtlsObjects.Inet It 
  38.       Left            =   10680
  39.       Top             =   7560
  40.       _ExtentX        =   1005
  41.       _ExtentY        =   1005
  42.       _Version        =   393216
  43.       URL             =   "http://"
  44.       RequestTimeout  =   10
  45.    End
  46.    Begin VB.TextBox QS 
  47.       Height          =   855
  48.       Left            =   7920
  49.       MultiLine       =   -1  'True
  50.       TabIndex        =   8
  51.       Text            =   "Form1.frx":0000
  52.       Top             =   1440
  53.       Width           =   3255
  54.    End
  55.    Begin VB.CommandButton Command1 
  56.       Caption         =   "PARSE DATA"
  57.       Height          =   375
  58.       Left            =   7920
  59.       TabIndex        =   7
  60.       Top             =   5520
  61.       Width           =   1455
  62.    End
  63.    Begin RichTextLib.RichTextBox T 
  64.       Height          =   7695
  65.       Left            =   0
  66.       TabIndex        =   6
  67.       Top             =   480
  68.       Width           =   7815
  69.       _ExtentX        =   13785
  70.       _ExtentY        =   13573
  71.       _Version        =   393217
  72.       Enabled         =   -1  'True
  73.       ScrollBars      =   2
  74.       TextRTF         =   $"Form1.frx":0006
  75.    End
  76.    Begin VB.TextBox txtID 
  77.       Height          =   285
  78.       Left            =   7920
  79.       TabIndex        =   5
  80.       Top             =   720
  81.       Width           =   975
  82.    End
  83.    Begin VB.CommandButton btnCalc 
  84.       Caption         =   "QUERY CDDB"
  85.       Height          =   375
  86.       Left            =   7920
  87.       TabIndex        =   4
  88.       Top             =   3600
  89.       Width           =   1455
  90.    End
  91.    Begin VB.ComboBox CB 
  92.       Height          =   315
  93.       Left            =   7920
  94.       TabIndex        =   3
  95.       Top             =   2760
  96.       Width           =   1455
  97.    End
  98.    Begin VB.CommandButton btnExit 
  99.       Caption         =   "CLOSE"
  100.       Height          =   375
  101.       Left            =   7920
  102.       TabIndex        =   2
  103.       Top             =   7800
  104.       Width           =   1455
  105.    End
  106.    Begin VB.TextBox txtURL 
  107.       Height          =   285
  108.       Left            =   0
  109.       TabIndex        =   1
  110.       Top             =   120
  111.       Width           =   11295
  112.    End
  113.    Begin VB.CommandButton cmdShowURL 
  114.       Caption         =   "GET DATA"
  115.       Height          =   375
  116.       Left            =   7920
  117.       TabIndex        =   0
  118.       Top             =   4560
  119.       Width           =   1455
  120.    End
  121.    Begin VB.Label Label2 
  122.       AutoSize        =   -1  'True
  123.       Caption         =   "WHATEVER"
  124.       Height          =   195
  125.       Index           =   5
  126.       Left            =   8160
  127.       TabIndex        =   18
  128.       Top             =   5280
  129.       Width           =   1290
  130.       WordWrap        =   -1  'True
  131.    End
  132.    Begin VB.Label Label1 
  133.       Caption         =   "4)"
  134.       BeginProperty Font 
  135.          Name            =   "MS Sans Serif"
  136.          Size            =   8.25
  137.          Charset         =   0
  138.          Weight          =   700
  139.          Underline       =   0   'False
  140.          Italic          =   0   'False
  141.          Strikethrough   =   0   'False
  142.       EndProperty
  143.       Height          =   255
  144.       Index           =   3
  145.       Left            =   7920
  146.       TabIndex        =   17
  147.       Top             =   5280
  148.       Width           =   255
  149.    End
  150.    Begin VB.Label Label1 
  151.       Caption         =   "3)"
  152.       BeginProperty Font 
  153.          Name            =   "MS Sans Serif"
  154.          Size            =   8.25
  155.          Charset         =   0
  156.          Weight          =   700
  157.          Underline       =   0   'False
  158.          Italic          =   0   'False
  159.          Strikethrough   =   0   'False
  160.       EndProperty
  161.       Height          =   255
  162.       Index           =   2
  163.       Left            =   7920
  164.       TabIndex        =   16
  165.       Top             =   4320
  166.       Width           =   255
  167.    End
  168.    Begin VB.Label Label2 
  169.       AutoSize        =   -1  'True
  170.       Caption         =   "DISPLAY DATA"
  171.       Height          =   195
  172.       Index           =   4
  173.       Left            =   8160
  174.       TabIndex        =   15
  175.       Top             =   4320
  176.       Width           =   1290
  177.       WordWrap        =   -1  'True
  178.    End
  179.    Begin VB.Label Label2 
  180.       AutoSize        =   -1  'True
  181.       Caption         =   "QUERY CDDB WEB SITE"
  182.       Height          =   255
  183.       Index           =   3
  184.       Left            =   8160
  185.       TabIndex        =   14
  186.       Top             =   3360
  187.       Width           =   2010
  188.       WordWrap        =   -1  'True
  189.    End
  190.    Begin VB.Label Label1 
  191.       Caption         =   "2)"
  192.       BeginProperty Font 
  193.          Name            =   "MS Sans Serif"
  194.          Size            =   8.25
  195.          Charset         =   0
  196.          Weight          =   700
  197.          Underline       =   0   'False
  198.          Italic          =   0   'False
  199.          Strikethrough   =   0   'False
  200.       EndProperty
  201.       Height          =   255
  202.       Index           =   1
  203.       Left            =   7920
  204.       TabIndex        =   13
  205.       Top             =   3360
  206.       Width           =   255
  207.    End
  208.    Begin VB.Label Label2 
  209.       AutoSize        =   -1  'True
  210.       Caption         =   "SELECT CD DRIVE"
  211.       Height          =   195
  212.       Index           =   2
  213.       Left            =   8160
  214.       TabIndex        =   12
  215.       Top             =   2520
  216.       Width           =   1515
  217.       WordWrap        =   -1  'True
  218.    End
  219.    Begin VB.Label Label1 
  220.       Caption         =   "1)"
  221.       BeginProperty Font 
  222.          Name            =   "MS Sans Serif"
  223.          Size            =   8.25
  224.          Charset         =   0
  225.          Weight          =   700
  226.          Underline       =   0   'False
  227.          Italic          =   0   'False
  228.          Strikethrough   =   0   'False
  229.       EndProperty
  230.       Height          =   255
  231.       Index           =   0
  232.       Left            =   7920
  233.       TabIndex        =   11
  234.       Top             =   2520
  235.       Width           =   255
  236.    End
  237.    Begin VB.Label Label2 
  238.       AutoSize        =   -1  'True
  239.       Caption         =   "UNIQUE DISC ID"
  240.       Height          =   315
  241.       Index           =   1
  242.       Left            =   7920
  243.       TabIndex        =   10
  244.       Top             =   480
  245.       Width           =   1275
  246.       WordWrap        =   -1  'True
  247.    End
  248.    Begin VB.Label Label2 
  249.       AutoSize        =   -1  'True
  250.       Caption         =   "QUERY STRING TO SEND"
  251.       Height          =   195
  252.       Index           =   0
  253.       Left            =   7920
  254.       TabIndex        =   9
  255.       Top             =   1200
  256.       Width           =   1995
  257.       WordWrap        =   -1  'True
  258.    End
  259. Attribute VB_Name = "CCDid"
  260. Attribute VB_GlobalNameSpace = False
  261. Attribute VB_Creatable = False
  262. Attribute VB_PredeclaredId = True
  263. Attribute VB_Exposed = False
  264. ' IF CONNECTION IS IMPOSSIBLE, TRY THIS SAMPLE AS A URL IN A BROWSER:
  265. 'http://cddb.cddb.com/~cddb/cddb.cgi/?cmd=cddb+read+rock+a10c480c&hello=BUZZLE+AA.BB.COM+CDclient+2.1&proto=4
  266. Private Const Sd1 = "http://cddb.cddb.com/~cddb/cddb.cgi/?cmd="
  267. Private Const Sd2 = "&hello=buzzle+no.host.com+NON+0.1&proto=4"
  268. Function Src(URL As String) As String
  269.     On Error GoTo drt
  270.     Src = It.OpenURL(URL)
  271.     Select Case It.ResponseCode
  272.         Case 0: Resume Next
  273.         Case Else: MsgBox It.ResponseCode
  274.     End Select
  275. End Function
  276. Private Sub cmdShowURL_Click()
  277.     Dim FND1%, Gn$, X$, XX$, DD$
  278.     Dim MyCD As New CCd, Y$, Z$
  279.     Dim Gen
  280.     Gen = Array("rock", "country", "soundtrack", "classical", _
  281.         "newage", "blues", "folk", "jazz", "reggae", "misc") 'ORDER NOT IMPORTANT
  282.     FND1 = T.Find("210", , , 2 Or 8)
  283.     If Not FND1 = 0 Then FND1 = T.Find("200", , , 2 Or 8)
  284.     If FND1 = 0 Then
  285.         For i = 0 To 10
  286.             If T.Find(Gen(i), 4, , 2 Or 8) > -1 Then
  287.                 Gn = Gen(i)
  288.                 Exit For
  289.             End If
  290.         Next
  291.     End If
  292.     XX = Sd1 & "cddb+read+" & Gn & "+" & txtID & Sd2
  293.     T.TextRTF = Src(XX)
  294.     txtURL.Text = XX
  295. End Sub
  296. Private Sub btnCalc_Click()
  297.     Dim MyCD As New CCd, X$, Y$, Z$, Drv$
  298.     If DvT(CB.Text) = 5 Then
  299.         MyCD.Init CB.Text
  300.     Else
  301.         MsgBox "Drive is not a CD."
  302.         Exit Sub
  303.     End If
  304.     txtID.Text = MyCD.DiscID
  305.     QS = MyCD.QueryString
  306.     X = Sd1 & MyCD.QueryString & Sd2
  307.     Me.txtURL = X
  308.     T = Src(X)
  309.     It.OpenURL (X)
  310.     DoEvents
  311. End Sub
  312. Private Sub Command1_Click()
  313.     Dim X%, XX%, Y$
  314.     Dim MyCD As New CCd
  315.     X = T.Find("DISCID=" & txtID, , , 2 Or 8)
  316.     XX = T.Find(vbCrLf & ".", , , 2 Or 8)
  317.     T.Text = Right(T.Text, Len(T.Text) - X)
  318.     T.Text = Left(T.Text, Len(T.Text) - 5)
  319. End Sub
  320. Private Sub Command2_Click(): T = Src(Sd1 & "sites" & Sd2): End Sub     'DISPLAY CDDB SITES
  321. Private Sub Command3_Click(): T = Src(Sd1 & "help" & Sd2): End Sub      'DISPLAY CDDB HELP
  322. Private Sub Command4_Click(): T = Src(Sd1 & "stat" & Sd2): End Sub      'DISPLAY CDDB STATS
  323. Private Sub Form_Load()
  324.     CB.AddItem "D:"
  325.     CB.AddItem "E:"
  326.     CB.AddItem "F:"
  327.     CB.AddItem "G:"
  328.     CB.AddItem "H:"
  329.     CB.AddItem "I:"
  330.     CB.ListIndex = 0
  331. End Sub
  332. Private Sub It_StateChanged(ByVal State As Integer)
  333.     On Error GoTo DD
  334.     Select Case State
  335.     Case 11
  336.     MsgBox It.ResponseCode
  337.     Case 8 ',12
  338.         Dim vD As Variant
  339.         Dim sD As String: sD = ""
  340.         Dim bD As Boolean: bD = False
  341.         vD = It.GetChunk(1024, 0)
  342.         DoEvents
  343.         Do While Not bD
  344.             sD = sD & vD
  345.             vD = It.GetChunk(1024, 0)
  346.             If Len(vD) = 0 Then bD = True
  347.         Loop
  348.         T.Text = T.Text & sD
  349.     End Select
  350.     Resume Next
  351. End Sub
  352. Private Sub btnExit_Click(): Unload Me: End Sub
  353.