Option Compare Database
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
On Error Resume Next
If WebBrowser1.busy = False Then
Call ResimGetir
End If
DoEvents
End Sub
Private Sub Form_Load()
WebBrowser1.silent = True
WebBrowser1.Navigate2 "https://www.kbs.gov.tr/gen/login.htm"
End Sub
Private Sub Komut10_Click()
Dim Html As HTMLDocument
Dim btn As HTMLButtonElement
Set Html = Me.WebBrowser1.Document
'bu kısımlar çalışıyor sıkıntı yok
HTML.all("user_name").Value = Me.mtn_kullaniciadi.Value
HTML.all("pass_word").Value = Me.mtn_sistemsifresi.Value
HTML.all("kaptcha").Value = Me.mtn_guvenlikresmi.Value
DoEvents
HTML.Forms("formA").submit
End Sub
Sub ResimGetir()
'fakat aşağıdaki kodları nasıl ayarlamalıyım ki uyguluma çalışsın
Dim HTML_Body, HTML_Img As Object, AlinanResim As Object
Dim TempDir As String
Set HTML_Body = WebBrowser1.Document.all.tags("Body").Item(0)
Set HTML_Img = HTML_Body.getElementsByTagName("img")
Set AlinanResim = HTML_Img(14)
TempDir = Environ("Temp")
URLDownloadToFile 0, AlinanResim.src, TempDir & "\1.png", 0, 0
Me.resim1.Picture = TempDir & "\1.png"
End Sub
kodlar üstte.