It's almost New Year's Eve. I have a lot of work and a lot of work. I'm afraid I can't hear more than 12306 yuan of votes. What a tangle !? Click it to create a "silent ticket pop-up window" tool

Source: Internet
Author: User




When you work in the office, there are bosses and leaders around you, but you are anxious to buy a train ticket for the Spring Festival, what should you do?

When I was driving a computer, I couldn't hear the sound of a pass train. What should I do if the bad voice, such as the QQ terminal tool, was released?

In order not to let others hear that you are buying a ticket, you have to turn off your voice, but you do not know that you have a ticket!

So I had to keep switching the window secretly, but I was not feeling at work because I saw the ticket.

Sometimes, even so, when you find that the ticket has arrived, When you click to submit the order, the ticket has long been gone :-《

For this reason, there are more than N of the best tickets on the list :-《





Some friends said they could try 360 and other automatic ticketing tools, but as a programmer, I decided to do it myself, to be full of food.


This article aims to solve the "Silent ticketing pop-up window" function. The main analysis requirement is that the "pop-up window" function is available on the 12306 page, but this is only a DIV layer, when you are working, plug-ins on browsers won't work. However, if you create a browser, the pop-up window function can be implemented.


To pop up the window, you need to know when the window will pop up. You need to monitor the DIV pop-up layer on the 12306 automatic ticket swiping page. Once it is found to pop up, you can immediately start your own pop-up window function.


Make your own browser and use the WebBrowser control. In the pop-up window, use the top property of the WinForm window. Now, let's get started!


1. Search for the 12306 ticket issuance prompt Layer

First, enter the appropriate conditions on the 12306 ticket snatching page, enable the "Automatic submission" function, and wait until the "ticket found, please check the following information" dialog box is displayed, use the developer tool of the browser. I use IE11 and press F12 to find the ID of this layer, as shown in:




Copy the relevant HTML code:


The ticket has been found.


Please check the following information


We know from the above that the ID of this layer is autosubmitcheckticketinfo, and its currently displayed style attribute is


div = webBrowser1.Document.GetElementById( (div != = (currDiv.style.display == || .TopMost = .TopMost =


The above Code uses the mshtml. IHTMLElement interface, which uses the features in Microsoft. mshtml. dll and can be obtained by referencing the MSHTML component in the COM component.





You can also use the HTMLDivElementClass class without using the mshtml interface, as shown in the following code:


mshtml.HTMLDivElementClass currDiv = (mshtml.HTMLDivElementClass)div.DomElement;

However, if a 32-bit system is compiled with VS and the Any Cpu is selected, the following problems may occur in the 64-bit system:


Other information: the COM Object of the type "mshtml. HTMLDivElementClass" cannot be forcibly converted to the interface type "mshtml. IHTMLRuleStyle ".

This operation fails because the following error occurs when QueryInterface is called on the COM component of the interface whose IID is {3050F3CF-98B5-11CF-BB82-00AA00BDCE0B:

This interface is not supported (the exception comes from HRESULT: The interoperability type "mshtml. HTMLDivElementClass" cannot be embedded ". Use the applicable interface instead.

3. pop-up window to the top layer

This function is simple, and the code above also gives, you only need to set the TopMost attribute of the current window to true. However, you cannot keep setting this way. Otherwise, the Work window cannot be switched out. Therefore, you can cancel the setting as soon as prompted.


.TopMost = ;

However, after executing this code, if the window of the ticket grabbing tool is minimized in the current period, after clicking the confirmation window, the ticket grabbing window still cannot be popped up in time. Here, some modifications are required. You only need to set the window mode to maximize before the window pops up. Of course, if the window is not minimized, it will be okay to directly overwrite the ticket booking window with the work window, and the window will pop up to the top right.


4. Modify the ticket flushing Interval

Here we will only discuss the technology.


Find the Windows property object of the HTML document associated with the WebBrowser control and call the execScript method. The refresh interval is 5 seconds and can be changed to another value. Since the interval between modification and refresh will increase the processing load by 12306, the specific modification is not directly published here. If you are interested, you can study it on your own.


win =, );

I tried to change the refresh interval to 0.1 seconds. During the peak purchase period, the remaining ticket information may be retained, but the program keeps refreshing. At this time, I need to modify the interval of refreshing the ticket, it is best to set it to more than 1 second, because it is useless to refresh the client frequently when the 12306 website is very stuck.


Therefore, it is generally enough to set the interval to 1 second, and try to use it on the premise of satisfying the declaration in this article, and then restore it to a normal 5 second interval.






1. Introduction:

By using the above method, You Can Diy your own ticketing tool. Now I have released the 12306 silent ticketing tool, and now you can work quietly, while purchasing tickets in time, I submitted the order!


According to the interface operation prompt, when there is a ticket, the program will automatically pop up the window to the top-level window of the current computer, ensure that you can operate in time! The following is the interface on which the tool monitors the issue and pops up in time:




For more instructions, see the tool instructions.




Note:


If you think the software is useful to you and are willing to support the development of open-source software, you can donate the author, donation information and account, please refer to the PDF. NET official website: http://www.pwmis.com/sqlmap, other places to publish information do not use.




2 ,:



On the open-source project download page of the PDF. NET development framework, download the following content:


Today-169 downloads Wed-4 downloads as long as you have them on your computer. NET 2.0 Framework or 4.0 framework can run this program. Generally, Win7 and Win8 can be used directly. MSHTML components may not be installed in some XP systems, you need to download the second file to the running directory. If the following error message appears, download it:


System. IO. FileNotFoundException: cocould load file assembly

One of its dependencies.

The system cannot find the specified file.

Download the second file above. The downloaded file name is Microsoft. mshtml. dll. bak, rename the file to Microsoft. mshtml. place the dll in the running directory of the ticket purchasing program.




PS: This morning, I used my own tool and finally bought a berth ticket :)


Before getting off work, I used the latest tool and bought an express pass :)






For the usage of the tool, you can follow the instructions or view the "help" of the tool program ". Please pay attention to the latest version at any time.




Version update information:

Ver 4.1.9 Ver 1.0.3 supports adjusting the refresh time

Ver 4.1.10 Ver 1.0.4 fixed the problem that the window of the minimal tool could not pop up the ticket purchase window to the top.

Operation prompt is added.












Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.