PS- If you really, really, really rather work with the DLL and API (which, again, seriously, are horrible) this is the function from the class i made when the http dns for decaptcher was fucked for like 2 weeks, which interopts in the shared dll methods. You will need to build a class around those shared dll methods (already in the vb.net source for decaptcher).
Code:
** * *Public Function SolveCaptcha(ByVal img As String, ByVal timeoutSetting As TimeoutLimits, _
** * * * * * * * * * * * * * * * * *Optional ByVal pictureType As Integer = 0, Optional ByVal fileExt As String = "jpg", _
** * * * * * * * * * * * * * * * * *Optional ByVal fileType As String = "image/jpeg") As DecaptcherResult
** * * * Dim dID As Integer
** * * * Dim dRet As Integer
** * * * Dim picByte As Byte()
** * * * Dim _captcha As Byte()
** * * * Dim major_id As Integer()
** * * * Dim minor_id As Integer()
** * * * Dim captchaText As String = ""
** * * * Dim bufSize As Integer = 255
** * * * Dim picTo() As Integer
** * * * Dim picType() As Integer
** * * * Dim dResult As New DecaptcherAPI.DecaptcherResult
** * * * Try
** * * * * *dID = CCprotoInit()
** * * * * *If dID >= 0 Then
** * * * * * * dRet = CCprotoLogin(dID, _host, _port, _name, _name.Length, _pw, _pw.Length)
** * * * * * * If dRet = 0 Then
** * * * * * * * *_captcha = New Byte(255) {}
** * * * * * * * *major_id = New Integer(1) {}
** * * * * * * * *minor_id = New Integer(1) {}
** * * * * * * * *picByte = Encoding.Default.GetBytes(img)
** * * * * * * * *picTo = New Integer(1) {}
** * * * * * * * *picType = New Integer(1) {}
** * * * * * * * *picType(0) = pictureType
** * * * * * * * *Select Case timeoutSetting
** * * * * * * * * * Case TimeoutLimits.Infinite : picTo(0) = 1
** * * * * * * * * * Case TimeoutLimits.NinetySeconds : picTo(0) = 4
** * * * * * * * * * Case TimeoutLimits.ServiceDefault : picTo(0) = 0
** * * * * * * * * * Case TimeoutLimits.SixtySeconds : picTo(0) = 2
** * * * * * * * * * Case TimeoutLimits.ThirtySeconds : picTo(0) = 3
** * * * * * * * *End Select
** * * * * * * * *dRet = CCprotoPicture2(dID, picByte(0), picByte.Length, picTo(0), picType(0), _captcha(0), 255, major_id(0), minor_id(0))
** * * * * * * * *captchaText = New String(Encoding.Default.GetChars(_captcha))
** * * * * * * * *captchaText = Replace(captchaText, Chr(0), "")
** * * * * * * * *dResult = New DecaptcherAPI.DecaptcherResult(dRet, captchaText, major_id(0), minor_id(0))
** * * * * * * End If
** * * * * * * dRet = CCprotoClose(dID)
** * * * * * * dRet = CCprotoDestroy(dID)
** * * * * *End If
** * * * Catch ex As Exception
** * * * * *Debug.WriteLine(ex.ToString)
** * * * End Try
** * * * img = Nothing
** * * * picByte = Nothing
** * * * Return dResult
** * *End Function
Bookmarks