Solved

AppBar registration

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

Thanks

Gustavo
0
Comment
Question by:voxel
  • 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
 

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now