728x90

VB.net 네이트온 팀룸 API 예제

Imports System
Imports System.Net
Imports System.IO
Imports System.Text.Encoding
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Call Nateon_team()
    End Sub


    Public Sub Nateon_team()
        Dim request As HttpWebRequest
        request = WebRequest.Create("https://teamroom.nate.com/api/webhook/######/##############")
        Dim response As WebResponse
        Dim postData As String = Now
        Dim data As Byte() = UTF8.GetBytes(String.Format("content={0}", System.Web.HttpUtility.UrlEncode(postData)))

        request.Method = "POST"
        request.ContentType = "application/x-www-form-urlencoded"


        Dim stream As Stream = request.GetRequestStream()
        stream.Write(data, 0, data.Length)
        stream.Close()

        response = request.GetResponse()
        Dim sr As New StreamReader(response.GetResponseStream())

        MsgBox(sr.ReadToEnd)
    End Sub

End Class

c# -> VB.net

출처 : http://2nusa.blogspot.com/2017/12/api-c.html

728x90

VB.NET - ImageSearchDLL.dll 이미지서치

 

    <DllImport("ImageSearchDLL.dll")> _
    Public Shared Function ImageSearch(ByVal x1 As Integer, ByVal y1 As Integer, ByVal right As Integer, ByVal bottom As Integer, ByVal findImage As String) As IntPtr
    End Function

 

        Dim img As String = ImageSearch(rc.left, rc.top, rc.right, rc.bottom, "*TransFF00FF *50 " & Application.StartupPath & "\" & img & ".png")
        '투명값 : *TransFF00FF 
        '오차율 : *50
        'Application.StartupPath : 응용 프로그램의 실행 경로
        
	Dim imgData() As String = Split(Marshal.PtrToStringAnsi(img), "|")
        '0 = 성공1, 실패0
        '1, 2 = 좌표 x, y

 

ImageSearchDLL.dll
0.11MB

728x90

VB.net - 디시 댓글 클리너

정상 작동하는지 까지만 확인했습니다.

IP 차단 위험성이 존재합니다

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("https://gallog.dcinside.com/")
    End Sub

    Private Sub Inject_Alert_Blocker()
        Dim head As HtmlElement = WebBrowser1.Document.GetElementsByTagName("head")(0)
        Dim script_element As HtmlElement = WebBrowser1.Document.CreateElement("script")
        Dim alert_blocker1 As String = "window.confirm=function(){return true;}"
        Dim alert_blocker2 As String = "window.alert=function(){return true;}"
        Dim alert_blocker3 As String = "window.close=function(){}"
        script_element.SetAttribute("text", alert_blocker1)
        head.AppendChild(script_element)

        script_element.SetAttribute("text", alert_blocker2)
        head.AppendChild(script_element)

        script_element.SetAttribute("text", alert_blocker3)
        head.AppendChild(script_element)
    End Sub

    Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
        Inject_Alert_Blocker()
        WebBrowser1.ScriptErrorsSuppressed = True
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Enabled = True
    End Sub
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        On Error Resume Next

        For Each divSect As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
                If divSect.OuterHtml.Contains("btn_box fr cont_btnbox") Then
                    For Each elem As HtmlElement In divSect.Children
                        If elem.GetAttribute("className") = "btn_delete btn_svc btn_lightgrey smaller" Then
                            elem.InvokeMember("click")
                        End If
                    Next
                End If
            Next

    End Sub
End Class

 

필요 컨트롤 - WebBrowser, Button, Timer

댓글말고 게시글도 위 코드 응용해서 지우면 됨

 

2021.05.08 - [VB.NET] - VB.NET - WebBrowser 메세지 창 제어

2021.05.10 - [VB.NET] - VB.net - WebBrowser의 Button 클릭하기

  1. 익명 2021.10.13 02:29

    비밀댓글입니다

728x90

VB.net - WebBrowser의 Button 클릭하기

참조 링크 - 

docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.htmlelement?view=net-5.0

stackoverflow.com/questions/52375257/click-on-a-button-in-a-webbrowser-control

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("https://www.daum.net")
    End Sub
        For Each divSect As HtmlElement In WebBrowser1.Document.GetElementsByTagName("div")
            If divSect.OuterHtml.Contains("inner_search") Then
                For Each elem As HtmlElement In divSect.Children
                    If elem.GetAttribute("className") = "ico_pctop btn_search" Then
                        elem.InvokeMember("click")
                    End If
                Next
            End If
        Next

 

DAUM html 소스

728x90

VB.NET - WebBrowser 메시지 창 제어

(blog.naver.com/lsc980109/220967886886 소스 참고하였음)

소스

    Private Sub Inject_Alert_Blocker()
        Dim head As HtmlElement = WebBrowser1.Document.GetElementsByTagName("head")(0)
        Dim script_element As HtmlElement = WebBrowser1.Document.CreateElement("script")
        Dim alert_blocker As String = "###"
        script_element.SetAttribute("text", alert_blocker)
        head.AppendChild(script_element)
    End Sub


    Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
        Inject_Alert_Blocker()
    End Sub

Dim alert_blocker As String = "###"

### 소스

1. "window.confirm=function(){return true;}"
2. "window.alert=function(){return true;}"
3. "window.close=function(){}"

return 값 : true = 확인, false = 취소

 

nancording.tistory.com/7

 

자바스크립트 메시지박스 : alert, prompt, confirm을 이용하기.

메시지박스에는 세가지 종류가 있습니다. 세가지 종류에는 alert, prompt, comfirm이 있습니다. 1. alert 사용자에게 단순한 정보를 제공하며, 보통 경고성 메세지를 표시합니다. window.alert("ALERT창 입니

nancording.tistory.com

 

비주얼베이직 6.0 소스

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
WebBrowser1.Document.parentWindow.execScript "window.confirm=function(){return true;}", "JavaScript"
WebBrowser1.Document.parentWindow.execScript "window.alert=function(){return true}", "JavaScript" 
WebBrowser1.Document.parentWindow.execScript "window.close=function(){}", "JavaScript" 
End Sub 

+ Recent posts