Delphi get all the window title and icon displayed on the taskbar

Delphi: let all the window title and icon displayed on the taskbar
in Delphi, in addition to the main window when other windows display or switch to focus upon. By default, the window title and icon will not be displayed in the taskbar, in order to achieve the same as the main window whenever the window display or focus, put the icon and title display on the current taskbar, and highlight available in unit files corresponding window to add the following code to achieve, thank you!
Unit Unit2;
interface
uses
the Windows, the Messages, the SysUtils, Variants, the Classes, Graphics, Controls, Forms,
the Dialogs;
type
TForm2 = class (a TForm)
Private
{Private Declarations}
public
{Public Declarations}
protected
Procedure the CreateParams (var the Params: TCreateParams); override; // override this method to
End;
var
Form2: TForm2;
Implementation
{$ R & lt *}. Dfm
Procedure Tform2.CreateParams (the Params var: TCreateParams);
the begin
Inherited the CreateParams (the Params);
Params.WndParent: = GetDesktopWindow;
End;
End.
Program analysis
 
when the program needs to create a form, issued to create a new form of WM_CREATE messages to the system, the system will instruct the program calls CreateWnd method to create a form, CreateWnd method before you create a form, call CreateParams procedure to obtain initialization parameters of the form, after obtaining these parameters, then call CreateWindowHandle method to create a window handle to complete the work to create a form. So, if we make the form displays a program icon on the taskbar, you need to modify the initialization parameters of the form, heavy CreateParams process.
Initialization parameters of the program window is packaged into a TCreateParams object type, the type defined as follows:
type
TCreateParams Record =
{window title text}
the Caption: the PChar;
{type of form, such WS_CHILD, WS_DISABLED like}
Style : DWORD;
{extended form type}
ExStyle: DWORD;
{left upper corner of the window}
X-, the Y: Integer;
{form width, height}
the width, the Height: Integer;
{parent form of the form handle}
WndParent: the HWND;
{LParam WM_CREATE message parameter point}
the Param: the Pointer
{Class contains some information related to the form, such as a mouse cursor, menu, etc.}
WindowClass: TWndClass;
{class name of the form}
WinClassName: Array [0..63] of Char;
End;
the CreateParams process when execute when the form is created, it was created initialization parameter records in the form. So if you want to display a form of icons, we must raise the level of the form, is about to set its parent window handle Windows desktop, the desktop can be obtained through the API function GetDesktopWindow, so as long as we are overloaded function Add the body of the statement "Params.WndParent
: = GetDesktopWindow;", you can achieve a form of icons, as is demonstrated in the example above.

Guess you like

Origin www.cnblogs.com/blogpro/p/11446111.html