Visual C # Pop-up Killer

Source: Internet
Author: User

Pop-up window killer is a program that can automatically close the IE pop-up window, it works in the system tray, according to a certain interval to detect the IE window, and then close the pop-up form. Finally, it also provides the ability to use a hotkey to kill pop-up windows.

Although there are already similar programs written in C + +, this article is about using C # to implement these features, and the scenario described in this article is faster than the way to find Windows.

This is a new topic, and we can see many similar programs on the Internet. But I would also like to take this opportunity to explain how the following techniques are implemented in C #:

System Tray

Program switching

Timing controls

Find window

System Hotkey

Generate a System tray program

First, a new C # Windows form program is generated, and the NotifyIcon control is dragged from the Toolbox onto the form, as shown in the following illustration:

To add a pallet to a C # Windows Form program

To ensure that the icon of the system tray and the icon of the application are consistent, we use a common icon file A.ico to set the system tray icon and the application icon.

In order for the program to not appear on the toolbar, we can set the Visible property of the form to false. This can be implemented directly in the form Properties window.

This. ShowInTaskbar = false;

So far, the system tray has been basically good, but we have not set the right menu, nor the program to show and hide the function.

Program switching

First, the program's main form can be selected for display or hidden depending on the state, and in addition, we can use WindowState to set the state of the form:

public void HideApp()
{
this.WindowState = FormWindowState.Minimized;
Hide();
}
public void ShowApp()
{
Show();
this.WindowState = FormWindowState.Normal;
}

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.