Tyskbar's mystery

zhaozj2021-02-08  245

Lu Lin

All

Dry your own window from Taskbar!

27 DEC 98 13:58:41

Hey. Let me find Taskbar secrets: DDD

Once the Win32 app creates a window, then he

A button will be displayed on the taskbar. To put the button

Dry out, from the SDK can't find any eliminated interfaces.

It turns out that MS has started to retain things again in the shell extension. Foot

8 small bubbles on the computer. Finally unveiled the secret.

It is a COM interface I have finished:

Declare_Interface_ (ItaskBarlist, IUNKNOWN)

{

STDMETHOD (THIS_RIID RIID, LPVOID * PPVOBJ) PURE

STDMETHOD_ (ULONG, ADDREF) PURE

STDMETHOD_ (ULONG, RELEASE) PURE

STDMETHOD (HWND) PURE

STDMETHOD (HWND) PURE

STDMETHOD (HWND) PURE

STDMETHOD (VOID) PURE

}

Typedef itaskbarlist * lpitaskbarlist;

So how to use it? Please see:

/ * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -

* Lu Lin wrote his own Window button from the source program from Taskbar.

* 1998.12.27.

* Welcome. Please do not delete any part

* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /

#include "wnd.h"

#include

#include

Declare_Interface_ (ItaskBarlist, IUNKNOWN)

{

STDMETHOD (THIS_RIID RIID, LPVOID * PPVOBJ) PURE

STDMETHOD_ (ULONG, ADDREF) PURE

STDMETHOD_ (ULONG, RELEASE) PURE

STDMETHOD (HWND) PURE

STDMETHOD (HWND) PURE

STDMETHOD (HWND) PURE

STDMETHOD (VOID) PURE

}; // If this section is added to shlobj.h, don't copy again every time.

Typedef itaskbarlist * lpitaskbarlist; // Defines a pointer. It is more like use SDK :)

Int WinApi Winmain (Hinstance Hinstance, Hinstance Hprevinstance,

LPSTR LPCMDLINE, INT) {

MSG msg;

WND * LPWND; // WND is responsible for creating a window. It is the class I wrote.

Lpitaskbarlist pobj = 0;

Coinitialize (0); // Initialize COM. Start Wonderful Component Object Model Tour :)

LPWND = New Wnd (Hinstance, LPCMDLINE, SW_MAXIMIZE); // Create a Window.

CoCreateInstance (CLSID_TASKBARLIST, 0, 1, IID_ITASKBARLIST,

(void **) & pobj); // CLSID_TASKBARLIST is defined in shlguid.h

// Another also. Fortunately, MS has these constants. Otherwise

/ / I have to check the registry yourself. Fortunately, this sentence will

// Return a pointer list. Point to the interface disclosed above.

POBJ-> hrinit (); // must do this. It is initialized: (he will tell Shell We // must have a move :)

POBJ-> deleteTab (lpwnd-> hwnd); // All or more code is to perform

// This code is prepared. He will kill Taskbar

// The button :) finally completed.

While (GetMessage (& MSG, 0, 0)) // This is a very common message loop.

{

TranslateMessage (& MSG);

DispatchMessage (& MSG);

}

Return 0;

}

The above contains basic function call sequences. Where WND is the class I wrote, (after all, no interest learning

MFC. It is also very simple to write yourself :)) The source program about the WND class is not post. Everyone should have

No use. So it is not posted. The above code does not have any error check. Please add it.

... I saw my letter, but the big complement! :). Lu Lin

--- Blue Boof 95 V2.54 [NR]

* Origin: Shang Hai Will University BBS (57956523) (6: 654/1007)

Lu Lin

All

Real tech (2)

16 May 99 23:54:36

Author: Lu Lin

Welcome to piracy, please go out.

1999.5.16

Today, I have to work again with Win9X Taskbar.

Last test, I took the button on Taskbar with COM. So Taskbar Irs

What is the operation?

I talked about the process. According to the MS document, an application button appears in Taskbar

The conditions are:

1. It is a Unowned window (not a window).

2. The window is the main window of the application. The child window of the application will not appear in Taskbar

On .Style contains WS_OVERLAPPED.

3. This window is in an Active state.

But if you meet the above conditions, the application will have a button. Obviously, I write

This article. There is definitely different from the MS documentation :) This belongs to some very skillful east

WEAT.

A TaskBar COM component can indeed control the generation and demise of the button, but COM components

It is a very super-layer thing. What controls the button on the Taskbar.

The answer is: What HOOK is relying on hook. What Hook? Shell Hook. When an app creates a window

When the mouth, the shell will issue a sequence of Shell messages to inform the Shell Hook. Then,

Taskbar's operation is done. Very much, I don't understand. But the fact is true.

Microsoft did not integrate the operation of Taskbar into showwindow () and other functions. Maybe

Depending on the principle of modularization, the USER module should not operate the function of the shell module. But this seems

Some of the consistent practice of Microsoft, seem to be the 'integration' unfavorable in the system. Because of one

The system component function is stripped to hook.

So, which shell hook message notifies the system, the button is generated? If you own

Write a shell hook, you will find that any HSHELL message cannot stop the system

Generate a button. But blocking hshell_windowdestroyed can prevent the system from deleting buttons.

Here is the skill in the skill .undocument, and it does not have a document later.

Because there is already a document that comes with a COM shell tells the programmaking how to operate the button :)

Any separate message interception cannot prevent the system from generating buttons. But through 3 messages

The joint interception can be done. The three news is:

Hshell_windowcreated, hshell_windowactivated, hshell_getminRect.

There is no one less. As long as these three messages do not flow to the Hook stream before Hook. The system will

Not responding responds to Taskbar after the application activates the Unalogned main window.

Of course, this is defective than COM. It is worse than COM calls simple and convenient. However, this is operated from the system

Close up one layer :)

... I saw my letter, but the big complement! :). Lu Lin

--- Blue Boof 95 V2.54 [NR]

* Origin: Shang Hai Will University BBS (57956523) (6: 654/1007)

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

New Post(0)