Solved

AppBar registration

Posted on 2000-03-21
8
296 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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