VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "VB调用例子"
   ClientHeight    =   3090
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command4 
      Caption         =   "Command4"
      Height          =   375
      Left            =   4080
      TabIndex        =   6
      Top             =   2640
      Width           =   495
   End
   Begin VB.CommandButton Command2 
      Caption         =   "发送文件"
      Height          =   360
      Left            =   1860
      TabIndex        =   5
      Top             =   2640
      Width           =   960
   End
   Begin VB.CommandButton Command1 
      Caption         =   "发送截图"
      Height          =   360
      Left            =   780
      TabIndex        =   4
      Top             =   2640
      Width           =   960
   End
   Begin VB.CommandButton Command3 
      Caption         =   "错误报告"
      Height          =   360
      Left            =   2940
      TabIndex        =   3
      Top             =   2640
      Width           =   960
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   840
      TabIndex        =   1
      Text            =   "2|F7D635C4-B2A2-4AB6-B7CF-EE87F4F64F29"
      Top             =   120
      Width           =   3600
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   2500
      Left            =   120
      Top             =   2640
   End
   Begin VB.ListBox List1 
      Height          =   1815
      Left            =   113
      TabIndex        =   0
      Top             =   600
      Width           =   4455
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "验证串:"
      Height          =   195
      Left            =   120
      TabIndex        =   2
      Top             =   180
      Width           =   585
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' 帐号注册 www.3QDaTi.com
' 错误返回值说明
' QQ交流群 222844761

Option Explicit

Dim m_dt As Object
Dim TID As String
Dim STime
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)




Private Sub Command4_Click()
Dim Answer
Answer = m_dt.GetAnswer("FB2A7FC2-E266-4971-AF11-D8129FE3224B")
End Sub

Private Sub Form_Load()
    Shell "regsvr32 /s QQQDaTi.dll"
    Set m_dt = CreateObject("QQQDaTi.Reply")
    Timer1.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set m_dt = Nothing
End Sub

Private Sub Command1_Click() '发送截图


    TID = m_dt.SendImage(Text1.Text, 2000, 1, 1, 300, 200, 300)

    If Len(TID) > 10 Then
        STime = Now
        List1.AddItem "等待答题"
        List1.AddItem TID
        Timer1.Enabled = True
    Else
        List1.AddItem TID
    End If
    List1.ListIndex = List1.ListCount - 1
End Sub

Private Sub Command2_Click() '发送文件


   
    TID = m_dt.SendFile(Text1.Text, 2000, App.Path & "\原图.bmp", 300)
   
  
    If Len(TID) > 10 Then
        STime = Now
        List1.AddItem "等待答题"
        List1.AddItem TID
        Timer1.Enabled = True
    Else
        List1.AddItem TID
    End If
    List1.ListIndex = List1.ListCount - 1
End Sub

Private Sub Command3_Click() '报错演示(答题错误时调用)

    'List1.AddItem m_dt.Report("FB2A7FC2-E266-4971-AF11-D8129FE3224B", Text1.Text)
    List1.AddItem m_dt.Report("FB2A7FC2-E266-4971-AF11-D8129FE3224B")
    List1.ListIndex = List1.ListCount - 1
End Sub

Private Sub Timer1_Timer() '获取答案
    Dim Answer As String
    Answer = m_dt.GetAnswer(TID)
    

    If Answer <> "-99" Then
        If Answer = "0" Then        '不确定
            '
        ElseIf Answer = "1" Then    '答案1
            '
        ElseIf Answer = "2" Then    '答案2
            '
        ElseIf Answer = "3" Then    '答案3
            '
        ElseIf Answer = "4" Then    '答案4
            '
        Else                        '其它返回值
            '
        End If
        
        List1.AddItem Answer
        List1.ListIndex = List1.ListCount - 1
        Timer1.Enabled = False
    End If
    If DateDiff("s", STime, Now) >= 300 Then
        List1.AddItem "答题超时"
        List1.ListIndex = List1.ListCount - 1
        Timer1.Enabled = False
    End If
End Sub
