2 Haziran 2014 Pazartesi
WEB SAYFASININ KODUNU ALMA ÖRNEĞİ
WEB SAYFASININ KODUNU ALMA ÖRNEĞİ
İNDİR
Not
:
Explorerden CTRL+C ile kopyalanıp panoya alınan site linki kodları anında RichTextBox 'ta Gösterilir.
Imports System.IO Imports System.Runtime.InteropServices Public Class Form1 Private Const WM_DRAWCLIPBOARD As Integer = &H308 Private Const WM_CHANGECBCHAIN As Integer = &H30D Private mNextClipBoardViewerHWnd As IntPtr Private Event OnClipboardChanged()
_ Private Shared Function SetClipboardViewer(ByVal hWnd As IntPtr) As IntPtr End Function
_ Private Shared Function ChangeClipboardChain(ByVal hWnd As IntPtr, ByVal hWndNext As IntPtr) As _
Boolean End Function
_ Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, _ ByVal lParam As IntPtr) As IntPtr End Function Protected Overrides Sub WndProc(ByRef m As Message) Select Case m.Msg Case WM_DRAWCLIPBOARD RaiseEvent OnClipboardChanged() SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) Case WM_CHANGECBCHAIN If m.WParam.Equals(mNextClipBoardViewerHWnd) Then mNextClipBoardViewerHWnd = m.LParam Else SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) End If End Select MyBase.WndProc(m) End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim kaynakkod As String Dim data As StreamReader Dim webRequest As Net.WebRequest Dim webresponse As Net.WebResponse webRequest = Net.WebRequest.Create(LinTxt.Text) webresponse = webRequest.GetResponse() data = New StreamReader(webresponse.GetResponseStream()) kaynakkod = data.ReadToEnd() RTB.Text = kaynakkod End Sub Private Sub ClipBoardChanged() If My.Computer.Clipboard.ContainsText Then If Uri.IsWellFormedUriString(My.Computer.Clipboard.GetText, UriKind.Absolute) Then LinTxt.Text = (My.Computer.Clipboard.GetText) End If End If End Sub Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load mNextClipBoardViewerHWnd = SetClipboardViewer(Me.Handle) AddHandler Me.OnClipboardChanged, AddressOf ClipBoardChanged End Sub Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing ChangeClipboardChain(Me.Handle, mNextClipBoardViewerHWnd) End Sub Private Sub LinTxt_TextChanged(sender As System.Object, e As System.EventArgs) Handles LinTxt.TextChanged Try Button1.PerformClick() Catch ex As Exception Debug.WriteLine(ex.Message) MessageBox.Show(ex.Message) Debug.WriteLine(ex.StackTrace) End Try End Sub End Class
Hiç yorum yok:
Yorum Gönder
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder