Delphi Full Control of Windows task bar

Source: Internet
Author: User

Core Tip: users of the WINDOWS95/NT/98 operating system know that when Windows starts normally, a task bar appears below the computer screen.

Users of the WINDOWS95/NT/98 operating system know that when Windows starts normally, a task bar appears below the computer screen. From a system functional standpoint, the entire taskbar consists of several different sub-areas, from left to right: The Start button, the application switching area (application switch bar), the taskbar notification area (Notification areas), and the taskbar clock. As with other Windows applications, the taskbar program (Systray.exe) consists of several different forms that have information such as their window class name, display method, and so on. As a result, you can programmatically control the different areas of the Windows taskbar as long as you get information about Windows.

  1. Programming Ideas

(1) The window information for the taskbar form is:

The window class name for the ① taskbar is: Shelltraywnd.

The window class name for the ② Start button is: button.

The window class name for the ③ application switch area is: ReBarWindow32.

④ the window class name for the notification area of the taskbar is: Traynotifywnd.

The window class name for the ⑤ task bar clock is: Trayclockwclass.

(2) Call the FindWindow function to get the window handle to the taskbar.

(3) Call the FindWindowEx function to get the window handle of each sub-area of the taskbar.

 

(4) According to the window handle, call the ShowWindow function to control the area of the taskbar to show or hide (show/hide), call the En ablewindow function to control the taskbar area is valid or invalid (enabled/disabled).

  2. Programming methods

(1) Create a new project Project1 in the Delphi3.0 IDE, Project1 contains Form1, as shown in the form:

(2) Define the window handle array: wnd:array[0. 4] of Thandle;

(3) The Gethandles process code is as follows:

Procedure Tform1.gethandles;

Begin

Get the window handle of tray bar;

Wnd[0]:=findwindow (′shelltraywnd′,nil);

Get the window handle of the Start button;

Wnd[1]:=findwindow (′shelltraywnd′,nil);

Wnd[1]:=findwindowex (Wnd[1],hwnd (0), ′button′,nil); Get the window handle of the application switch area;

Wnd[2]:=findwindow (′shelltraywnd′,nil);

Wnd[2]]:=findwindowex (Wnd[2],hwnd (0), ′rebarwindow32′,nil);

Gets the window handle of the notification area of the taskbar;

Wnd[3]:=findwindow (′shelltraywnd′,nil);

Wnd[3]:=findwindowex (Wnd[3],hwnd (0), ′traynotifywnd′,nil);

Get the window handle to the taskbar clock;

Wnd[4]:=findwindow (′shelltraywnd′,nil);

Wnd[4]:=findwindowex (Wnd[4],hwnd (0), ′traynotifywnd′,nil);

Wnd[4]:=findwindowex (Wnd[4],hwnd (0), ′trayclockwclass′,nil);

End

http://blog.csdn.net/yanjiaye520/article/details/6659536

Delphi Full Control of Windows task bar

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.