How to delete an icon on a taskbar on a taskbar

zhaozj2021-02-08  214

Home:

http://www.maxss.net

Email: Maxchou@163.com

If you don't know how to program the programming knowledge and content of the icon of the taskbar, please see another article. "

Implement the task bar icon in the C Builder "or read the contents related to the MSDN.

Everyone may ask, is this functional meaning? In fact, this is not a kind of behavior for other programs. In general, there is also its practical value. Sometimes we do this is to hide some don't want others to know if a particular program has already run. by"

This article should have a knowledge and content of the taskbar icon programming with C Builder. "This article should master the knowledge and content of the taskbar icon programming, so it is only elaborated and implemented here.

To determine a taskbar icon is

NOTIFYICONDATA structure

HWND and

UID two members are determined. So you must get the handle of the main window of the specified program and know that it is in the UID value of the taskbar icon. The handle of the main window We can get through the FindWindow () function, but in general, the value of the UID is set by the software developer's time written by the code, so you will not know how much it is. . You can know by reviewing MSDN, this parameter is a UINT type data type (unsigned int), that is, 32-bit unsigned integers, its value range is from 0 ~ (2 ^ 32 x 2) -1, here In the case of the result, it is possible to achieve the icon on the taskbar of the taskbar by the following FOR cycle.

Alternatively, the shell_notifyicon () function call successfully returns TRUE, which can exit the cyclic body in advance according to the return value.

The following code I was debugged under C Builder Windows 2000:

HWND HWND = FindWindow (NULL, "Application Caption");

IF (hwnd! = null)

{

Notifyicondata ni;

MEMSET (& ni, 0, sizeof (ni));

ni.cbsize = sizeof (ni);

Ni.hwnd = hwnd;

For (uint i = 0; i <8589934592; i )

{

Ni.uid = i;

IF (Shell_Notifyicon (Nim_Delete, & Ni))

Break;

}

}

Note: The delete icon does not mean the end program process. If you still need to end the program process, you can implement it by calling the sendMessage () function or the TerminateProcess () function. The specific code is no longer given here, leaving the readers who are interested in yourself. Realize it.

转载请注明原文地址:https://www.9cbs.com/read-2149.html

New Post(0)