?
Solved

AppBar registration

Posted on 2000-03-21
8
Medium Priority
?
306 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 300 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Technology Partners: 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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

752 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