Create an HTA without the "close" button in the title bar

Source: Internet
Author: User

Q:
Hello, script expert! How do I create an HTA without the "close" button in the title bar?
-- AK
A:
Hello, AK. You know, your problems have put us in a moral and ethical dilemma. After all, if we give the answer to this question: this world may suddenly be overwhelmed by a large number of HTA that cannot be closed. In front of our eyes, there is a picture: HTA, which cannot be closed and cannot be stopped, frantically swept across the land and swallowed all the system resources along the way. Our scripting experts will be responsible for this. We just feel that we cannot bear such a guilt in our conscience.
But what is the difference between adding one more guilt to our conscience? After clarifying this point, we provide the following HTA that cannot be closed; the only way to disable it is to terminate the Mshta.exe process (or let the Army Air Force take down it from the top of the Empire State Building ):
<Html>
<Head>
<Title> Test </title>
</Head>
<HTA: APPLICATION
SysMenu = "no"
>
<Body>
<P> This HTA has no Close button. </p>
</Body>
</Html>
When you run it, the results are similar:

So how do we remove the "close" button (not to mention "maximize" and "minimize" buttons) and keep the window title bar? Simple: you only need to set the SysMenu attribute value to no:
<HTA: APPLICATION
SysMenu = "no"
>
Setting the SysMenu value to no (this must be done internally in the HTA: APPLICATION tag) removes the "close" button, "maximize" and "minimize" button, and system menu. You can still move the window four times (click the title bar and drag it), but there is no way to close the window.
Yes, our conscience is a bit uneasy at the moment. (Although this is probably because we have finished the last cup of coffee, we are too lazy to try a pot again .) The following is a modified HTA without the "close" button in the title bar. However, there is indeed an Exit button in its subject. Click this button. A subroutine named ExitProgram closes the HTA window:
<Html>
<Head>
<Title> Test </title>
</Head>
<HTA: APPLICATION
SysMenu = "no"
>
<Script language = "VBScript">
Sub ExitProgram
Window. close ()
End Sub
</SCRIPT>
<Body>
<Input id = runbutton type = "button" value = "Exit" onClick = "ExitProgram">
</Body>
</Html>
In this case, we will get a similar HTA:

For full consideration, it may be better to find a way to disable HTA normally. However, it is up to you to decide. And your conscience

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.