Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (4)


Modifying Contents of the Taskbar from Delphi applicationFormat this article printer-friendly!Bookmark function is only available for registered users!
Using ITaskbarList interface
Product:
Delphi all versions
Category:
Shell API
Skill Level:
Scoring:
Last Update:
05/13/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet Taskbar ITaskbarList
Times Scored:
4
Visits:
4478
Uploader: Igor Kurilov
Company:
Reference: N/A
 
Question/Problem/Abstract:
How to add my form to taskbar
Answer:



The ITaskbarList interface is used to control the taskbar. First of all we have to declare ITaskbarList interface in the project:

const
CLSID_TaskbarList: TGUID = '{56FDF344-FD6D-11d0-958A-006097C9A090}';
type
ITaskbarList = interface
['{56FDF342-FD6D-11d0-958A-006097C9A090}']
{ virtual HRESULT STDMETHODCALLTYPE HrInit( void) = 0;}
   function HrInit: HResult; stdcall;
{ virtual HRESULT STDMETHODCALLTYPE AddTab(
            /* [in] */ HWND hwnd) = 0; }
   function AddTab(hwnd: Cardinal): HResult; stdcall;
{ virtual HRESULT STDMETHODCALLTYPE DeleteTab(
            /* [in] */ HWND hwnd) = 0; }
   function DeleteTab(hwnd: Cardinal): HResult; stdcall;

{ virtual HRESULT STDMETHODCALLTYPE ActivateTab(
            /* [in] */ HWND hwnd) = 0; }
   function ActivateTab(hwnd: Cardinal): HResult; stdcall;

{ virtual HRESULT STDMETHODCALLTYPE SetActiveAlt(
            /* [in] */ HWND hwnd) = 0; }
   function SetActiveAlt(hwnd: Cardinal): HResult; stdcall;
end;

Then we have to create instance of taskbarlist object and initialize it:

procedure TForm1.FormCreate(Sender: TObject);
begin
FTaskbarList:= CreateComObject(CLSID_TaskbarList) as ITaskbarList;
FTaskbarList.HrInit;
end;

Now we can change contents of taskbar:

procedure TForm1.FormShow(Sender: TObject);
begin
FTaskbarList.AddTab(Handle);
end;

procedure TForm1.FormHide(Sender: TObject);
begin
FTaskbarList.DeleteTab(Handle);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
FTaskbarList.ActivateTab(Handle);
end;







Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Error creating com object
    Roman Bratny (Dec 4 2002 3:18PM)

Why I have not registered class error?
(win 2000, IE 6.0)
Respond

FTaskbarList defined?
    Simone Carnio (May 26 2002 7:18AM)

how i have to define FTaskbarList?


Respond

RE: FTaskbarList defined?
Simone Carnio (May 26 2002 7:53AM)

mmm... just found.
maybe   ftaskbarlist:ITaskbarList; can work;

There is a particular use of this code?
it seem's to work only with handle of the application, not with other window. it is usable to show form2 on the taskbar? it this an possible utilize?
Respond

RE: RE: FTaskbarList defined?
Igor Kurilov (May 27 2002 6:47AM)

There is a particular use of this code?
it seem's to work only with handle of the application, not with other window. it is usable to show form2 on the taskbar? it this an possible utilize?

The code wil work with  any form handle in your application. You can display documents in the taskbar (for example MS Word & Exel can do so).
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
D. Souchard
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)