我希望将此captcha放入图片框中,在vb中。 目标是访问网站并将验证码图像发送到程序,以便用户在TextField中编写验证码文本并访问网站内容。
有可能吗? XD 我已经拥有的代码是波纹管(它工作,但它没有得到验证码图像:() 大家,我感谢所有的帮助
Private Sub txtFileURL_TextChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtFileURL.KeyDown
If e.KeyCode = Keys.Enter Then
Dim fileURL As String = txtFileURL.Text
Dim fileName As String = My.Computer.FileSystem.GetName(fileURL)
Dim saveFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim saveFullPath As String = saveFolder + "\" + fileName
Try
My.Computer.Network.DownloadFile(fileURL, saveFullPath)
MsgBox("Saved in Desktop!")
Catch ex As Exception
MsgBox(ex.Message)
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("D:\test.txt", True)
file.WriteLine(ex.Message)
file.Close()
End Try
End If
End Sub
答案 0 :(得分:0)
回答:ADyson
好吧,正如错误中所提到的,您的网址中缺少协议。尝试将http://(或https://,无论哪个)添加到URL字符串的开头。代码不知道在发出下载请求时要使用哪些(或任何其他)协议。