Netbox-random port code with error prompt and pop-up window

Source: Internet
Author: User

Dim httpd

Shell. Service. Icon = '\ 4088738 \ on.gif' ------ this is the icon you set yourself. You can follow this for friends who do not change the icon.

Shell. Service. runservice 'web', 'test', 'My space'

'---------------------- Service event start ---------------------

Sub onServicestart ()

Shell. Service. settimer 100

Set httpd = Createobject ('netbox. httpserver ')

If httpd. Create ('', 0) = 0 then

Set host = httpd. addhost ('','')

Host. enablewrite = false

Host. enablescript = true

Host. adddefault 'default. asp'

Host. adddefault 'default.htm'

Host. adddefault 'default.html'

Host. adddefault 'index. asp'

Host. adddefault 'index.htm'

Host. adddefault 'index.html'

Httpd. Start

Set htwin = Createobject ('netbox. htmlwindow ')

Htwin. Open 'HTTP: // 127.0.0.1/'------ the page is automatically opened by random ports.

Htwin. showdialog

Else

Shell. msgbox 'your port has been occupied, please close other programs before using ', 'xx homepage http://www.xxx.net/''' ------ this is the prompt when you encounter port occupation

Shell. Quit 0

End if

End sub

Sub onServicestop ()

Httpd. Close

End sub

Sub onServicepause ()

Shell. Service. Icon = '\ 4088738 \ off.gif'

Shell. msgbox 'server paused! Remember to open it when needed! ', 'Xx homepage http://www.xxx.net/''------ this is the prompt when your program is paused

Httpd. Stop

End sub

Sub onServiceresume ()

Httpd. Start

End sub

Sub onServicetimer

If shell. Service. Icon = '\ 4088738 \ on.gif' then

Shell. Service. Icon = '\ 4088738 \ on1.gif'

Else

Shell. Service. Icon = '\ 4088738 \ on.gif'

End if

End sub

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.