Solved

AppBar registration

Posted on 2000-03-21
8
299 Views
Last Modified: 2010-04-04
How to register an application as a windows appbar (windows NT) ?

Thanks

Gustavo
0
Comment
Question by:voxel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2642119
hi,
this is from a p.a.q

Q: How can I register my application as a taskbar?

A: You simply can align a form to the top e.g. and set the FormStyle
      Property to fsStayOnTop, so that no app can hide yours. But
      There are at least two problems: a) some other apps or windows
      still can cover your taskbar's window when they have the same
      stay-on-top property set and b) it does not define new Desktop
      metrics, so if an application maximizes, it lays behind your
      form instead of aligning to it. So you have to register that
      form as an ordinary taskbar:

procedure RegisterTaskBarH(FormHandle: THandle; Metrics: TRect;
        Align: byte; UnRegister:boolean);
var AppStruct: TAppBarData;
begin
if UnRegister=false then begin //means you want to register a form
   with AppStruct do begin
        cbSize:=                SizeOf(AppStruct); //set record's size
        hWnd:=                  FormHandle; //e.g. Form1.Handle
        uCallBackMessage:=      WM_Activate;
        Rc:=                    Metrics;
        lParam:=                WM_Activate;
        case Align of //where shall it be placed? top, bottom...?
             tbaTop: uEdge:=    ABE_Top;
             tbaBottom: uEdge:= ABE_Bottom;
             tbaLeft: uEdge:=   ABE_Left;
             tbaRight: uEdge:=  ABE_Right;
        end;
   end;
   SHAppBarMessage(ABM_New,AppStruct); //add your form
   SHAppBarMessage(ABM_SetPos,AppStruct); //set it's position
   SHAppBarMessage(ABM_Activate,AppStruct); //activate it
   //and notify all other windows that your taskbar occupies a
   //special area (the metric bounds) on Desktop; thus they "know"
   //how far they can maximize etc.
   SHAppBarMessage(ABM_WindowPosChanged,AppStruct); //that's it!
end else begin //or we want to release our app
    with AppStruct do begin //clear parameters
         Rc:=rect(0,0,0,0);
         cbSize:=SizeOf(AppStruct);
         hWnd:=FormHandle;
         uCallBackMessage:=WM_Close;
    end;
    SHAppBarMessage(ABM_SetPos,AppStruct); //..feed functions with "nil"
    SHAppBarMessage(ABM_Activate,AppStruct);
    SHAppBarMessage(ABM_WindowPosChanged,AppStruct);
    SHAppBarMessage(ABM_Remove,AppStruct);
end;
end;


If your window shall be placed to the top of the Desktop, you would call
the procedure this way:

with Metrics do begin //type: TRect
     Left:=   0;
     Top:=    0;
     Bottom:= Screen.Width;
     Right:=  Form1.Height;
end;

RegisterTaksBarH(Form1.Handle, Metrics, tbaTop, false);


Regards Barry
0
 

Author Comment

by:voxel
ID: 2642240
I will ask your help again before give you the points.

I did it, but other windows still lay behind my appbar when they maximize.

I have then code above in the OnCreate of the bar:

procedure TForm1.FormCreate(Sender: TObject);
begin
    Self.Top := 0;
    Self.Left := 0;
    Self.Width := 800;
    Self.Height := 80;
    appbarrc.Left := 0;
    appbarrc.Top := 0;
    appbarrc.Bottom := Screen.Width;
    appbarrc.Right := Form1.Height;
    RegisterTaskBarH(Form1.Handle, appbarrc, tbaTop, false);
end;


Is something wrong ?
0
 
LVL 17

Expert Comment

by:inthe
ID: 2642363
i will do some tests to see whats wrong  becuase that should not happen .
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:voxel
ID: 2642372
Forget about the comment I posted before.

The problem is that my form window moves below the bar area together with other windows, and the bar area remains empty.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2642438
i can send you proper examples of appbar if needed.
well it's the only example i ever seen for delphi and called appbar14.zip.. maybe you have seen it before?
0
 

Author Comment

by:voxel
ID: 2642484
No, I have never heard about it. But if you can send me some examples, I would like to.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2642506
sure i'll send it ,where shall i send to ?
0
 

Author Comment

by:voxel
ID: 2642571
gustavo@camerasurf.com

ok, thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question