Use VB.Net to make a forum posting software

zhaozj2021-02-16  52

Use VB.Net to make a forum posting software

Riveastking

Issue: If you often make a macro theory, if you want to submit your software to the relevant website in a short time, if you want to quickly log in to each search engine, if you want to be a forum to send Post software, this article may help you. Development Tools: Microsoft Visual Studio .NET 2003 Operating System: Windows XP does not program automatic posting

Can you realize the forum automatic posting? The answer is affirmative. Before October 2003, I haven't learned programming (VB6), but I have implemented the forum automatic pencil. Although I don't have to use this method now, I may use it for some friends, or here, I will introduce the implementation method. The principle of implementation is: Borrowing the software of the analog keyboard, the mouse operation, grab the input box mock, then simulate the mouse to the specified coordinate, analog keyboard input character, simulate the carriage return or click the appropriate location to complete the auto post. Of course, you have to write the corresponding automation script, although there is a difficulty, but for programming, it should be simple. There are three simulated keyboards, mouse classes, and the function is better, and it has already introduced "vs.net learning methodology". I. PcWorker (http://www.pcWorker.net) PCWORKER has a lot of features, more importantly, the script code in PCWorker is code:

PRESS VK_F1 // Simulation Press F1 Key Press VK_CTRL VK_F // Simulation Press Ctrl F

Is it not too difficult? II. "Http://www.vrrothers.com/cn/qmacro) relatively, button wizards are easily used, but only the PCWORKER is small. For example, PcWorker can output random numbers, but the keys cannot be done. The script code of the button elves is not easy to understand, such as KeyPress 82 1 you can see which key is it? III. Ezscript (http://ezscript.seed.cx/) Ezscript features a lot. But I didn't respond when I was automatically posting next to Windows XP. Beginners recommends using the button elves, advanced with PCWORKER. Use the tutorial, please refer to the author website. Use the AxWebBrowser control to make the forum automatically post the software AxWebBrowser control, the webbrowser control in VB6. Use AXWebBrowser to make a batch of the forum to post software, add reference to the AxWebBrowser control and MSHTML when using. First navigate to the specified URL. Then wait for the web page to load with the following code:

Do while brow.busy application.doevents () loop

Then call the posting process.

Public Sub fill () On Error Resume Next Do While brow.Busy Application.DoEvents () Loop Dim webDoc As Object = brow.Document.all Dim webTag As Object Dim lengthTag As Integer = webDoc.length - 1 For countTag As Integer = 0 To lengthtag webtag = WebDoc.Item (counttag) Select case strings.lcase (WebDoc.Item (counttag) .Tagname) Case "textarea" 'page text box Select Case Webtag.name Case "Body" "Body" from the web Source code, different websites are likely to be different, you can modify it according to actual changes. Same. Webtag.value = strbody 'This is a predefined value, the same below. End Select Case "SELECT" 'page Down-down selection box Select Case Webtag.name Case "Month"' Select the month, this is slightly selected last year, day selection, because the principle is the same.

WebTag.all.Item (1) .selected = true 'Select the first value END SELECT CASE "input" page in the input box Select Case strings.lcase (WebTag.Type) Case "text"' Text Select Case WebTag. Name case "name", "userid", "nickname" 'User name WebTag.Value = strname case "subject"' Title WebTag.Value = strsubject case "regid" 'registration code WebTag.value = strregid case "username", " realname "webTag.value = strUsername Case" cardnumber "webTag.value = strCardNumber Case" homephone "webTag.value = strHomephone 'telephone number Case" url_title "' link name webTag.value = urlTitle Case" url " 'link webTag.value = URL CASE "email" 'email address WebTag.Value = email case "img"' picture Webtag.value = img case "MIDI" 'Music WebTAG. Value = midi case "year" 'year Webtag.value = strsyr case "prompt" Retrieve Password prompt problem WebTag.Value = strprompt case "answer" "Retrieve password answer WebTag.Value = STRANSWER End Select Case" password "' Password Select Case Webtag.Name Case "Passwd", "Password", "confirm", "repasswd" password,

Confirm password webTag.value = strPass End Select Case "checkbox" 'radio button Select Case webTag.name Case "emailme"' email Notify me webTag.checked = True End Select End Select End Select Next brow.Document.forms (0) .submit () 'Many web forms, this simple code is automatically submitted END SUB, the main process is like this:

Public Sub AutoAd () Brow.silent = True 'does not pop up Brow.naviGate ("http://www.riveastking.com")' My Small Station as an Example Do WHILE FORMBROWNETSH.BROW.BUSY 'Waiting for the web to load the Application .Doevents () loop call fill () end sub

The above code can realize the visualization automatic registration and forum automatic posting tool. There are also a few questions to be resolved: 1. Some websites must fill in the identification code to register or speak, how to use the program to automatically identify the number on the identification code picture? II. Some websites will jump out of a welcome dialog, and the operation of the program is suspended. III. For automatic registration and speeches, load slower pictures, flash, music, etc. are not required. Use the HTTPWebRequest class to do the forum Quick Presidents to use the HTTPWebRequest class to do more. We have never forgotten that the best tutorial is MSDN, taking httpwebrequest in Microsoft Visual Studio .NET 2003, copying some stuff (in fact, many tutorial books are copied from MSDN): Namespace: The System.Net HttpWebRequest class provides support for the properties and methods defined in WebRequest, also supporting the user directly with additional properties and methods interacting with HTTP. Do not use the HTTPWebRequest constructor. Use a WebRequest.create method to initialize a new instance of HttpWebRequest. If the scheme of the URI is http: // or https: //, create will return to the HTTPWebRequest instance. The getResponse method issues a synchronization request to the Internet resource specified in the Requesturi property and returns an HttpWebResponse instance that contains the response. You can use the BegingeTResponse and EndgetResponse methods to emit asynchronous requests for Internet resources. When you want to send data to the Internet resource, the getRequestStream method returns a Stream instance for transmitting data. The BegingeTRequestStream and EndgetRequestStream methods provide asynchronous access to the sending data stream. If an error occurs when accessing the Internet resource, the HTTPWebRequest class will trigger WebException. WebException.status properties is one of the WebExceptionStatus values, which indicates an error source. When WebException.status is WebExceptionStatus.Protocolerror, the Response property contains HttpWebResponse received from the Internet resource.

Shared Sub postData () Dim httpUrl As New System.Uri ( "http://www.riveastking.com?" & "Name = yourName & pass = yourPass & cardnumber = yourCardNumber") Dim req As HttpWebRequest 'req.Timeout = 10000' set the timeout value 10 seconds req = CType (WebRequest.Create (httpUrl2), HttpWebRequest) req.Method = "POST" req.ContentType = "application / x-www-form-urlencoded" Dim bytesData () As Byte = System.Text.Encoding. ASCII.GetBytes ( "" name = yourName & pass = yourPass & cardnumber = yourCardNumber ") req.ContentLength = bytesData.Length Dim postStream As Stream = req.GetRequestStream () postStream.Write (bytesData, 0, bytesData.Length) 'above post information to the server . Dim res As HttpWebResponse = CType (req.GetResponse (), HttpWebResponse) 'acquires the server returns the following information Dim reader As StreamReader = _ New StreamReader (res.GetResponseStream, System.Text.Encoding.GetEncoding ( "GB2312")) Dim respHTML As string = reader.readToEnd () msgbox (resphtml) 'This is the information of the information returned to the web server POST' Return to the status code returned to the web server POST RES.Close () 'Close End Sub Use the AxWebBrowser control to do a forum There are three problems with the post, and the HTTPWebRequest class is used to implement, and the next two problems do not exist. Moreover, with the HTTPWebRequest class to achieve much more speeds of the forum posters. But the same? Some websites must fill in the identification code number to register or speak, how to use the "Forum Auto Posted" to automatically identify the numbers on the image picture?

We plus threads in the main process, because we have to use multi-threaded to make automatic pencils. Doing the forum automatic patchwork in VB6 in VB6, it is not difficult to do automatic posting tools in VB.NET.

Dim threadAdd As System.Threading.Thread 'custom thread Public Sub threadAutoAdd () threadAdd = New System.Threading.Thread (AddressOf postData)' Create a thread instance threadNetsh.Start () 'start threads' Remember in Sub postData () of Finally, add threadautoadd.abort () to close the thread 'or add the code that judges sub poster (), if you have finished, turn off the thread End Sub

Visual Studio .NET 2003 is a comprehensive development tool that quickly builds the Microsoft Windows? And Web and connects to Microsoft .NET applications, is it great to improve our development efficiency? Http://www.riveastking.com January 24, 2004

转载请注明原文地址:https://www.9cbs.com/read-22812.html

New Post(0)