Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to get detailed information about the Windows taskbar programmatically Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
02-Oct-02
Category
System
Language
Delphi 2.x
Views
49
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius
\I'm trying to determine the edge and rectangle of the Windows taskbar, using the 
SHAppBarMessage API - but how do I get the Windows taskbar handle?

Answer:

I put a procedure together that gets all the information one would want to get 
about the TaskBar: Pos (Rect), Edge, window handle, and whether it's set to be 
AutoHide or AlwaysOnTop. I got the parameter and return information by following 
the parameter value entries within the Win32 Programmers' reference Online Help 
file. I also used a 1 second timer to fire the ButtonClick, so that I could test 
dragging and resizing the TaskBar. I'm not sure if the "Edge section" of code 
(ABM_GETAUTOHIDEBAR) will work properly if there are other AppBars on the system.
1   
2   procedure GetTaskBarData(var AppBarInfo: TAppBarData; var AutoHide, AlwaysOnTop:
3     boolean);
4   var
5     i, RetVal: Cardinal;
6   begin
7     fillchar(AppBarInfo, sizeof(AppBarInfo), 0);
8     AppBarInfo.cbSize := sizeof(AppBarInfo);
9     RetVal := ShAppBarMessage(ABM_GETSTATE, AppBarInfo);
10    AutoHide := RetVal and ABS_AUTOHIDE > 0;
11    AlwaysOnTop := RetVal and ABS_ALWAYSONTOP > 0;
12    for i := 0 to 3 do
13    begin {ask all the edges}
14      AppBarInfo.uEdge := i; {then drop the Taskbar Handle into AppBarInfo}
15      AppBarInfo.hWnd := ShAppBarMessage(ABM_GETAUTOHIDEBAR, AppBarInfo);
16      if AppBarInfo.hWnd <> 0 then
17        break;
18      {the Taskbar's edge value is left in uEdge by the break}
19    end;
20    SHAppBarMessage(ABM_GETTASKBARPOS, AppBarInfo);
21  end;
22  
23  procedure TForm1.Button1Click(Sender: TObject);
24  var
25    ABI: TAppBarData;
26    AHide, AlOnTop: Boolean;
27    s: string;
28  begin
29    GetTaskBarData(ABI, AHide, AlOnTop);
30    with ABI do
31    begin
32      caption := format('%d %d %d %d', [rc.left, rc.top, rc.right, rc.bottom]);
33      case uEdge of
34        ABE_BOTTOM: s := 'Bottom';
35        ABE_LEFT: s := 'Left';
36        ABE_RIGHT: s := 'Right';
37        ABE_TOP: S := 'Top';
38      end;
39      if AHide then
40        s := s + ' AutoHide';
41      if AlOnTop then
42        s := s + ' AlwaysOnTop';
43      caption := caption + ' ' + s;
44    end;
45  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC