?
Solved

Application as a toolbar

Posted on 2004-11-25
4
Medium Priority
?
142 Views
Last Modified: 2010-04-05
I want to make an app will will stay 'ontop' and in the upper part of the screen but all windows, even maximized, should not ocupy the surface of my application.

Something like the Office Toolbar.
0
Comment
Question by:xtremecris
4 Comments
 
LVL 1

Author Comment

by:xtremecris
ID: 12675213
I can make the OnTop with FormStyle, I can position the app in the upper part of the screen. But I can't figure out how to make windows not use the surface of my application(as if the desktop surface would be smaller, Office Toolbar does this).
0
 
LVL 17

Expert Comment

by:geobul
ID: 12675381
Hi,

Try this:

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  rectOri: TRect;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  rect: TRect;
begin
  Left := Screen.DesktopLeft;
  Top := Screen.DesktopTop;
  Width := Screen.DesktopWidth;
  Height := 50; // your form height here

  FormStyle := fsStayOnTop;

  // Get the current available work area
  SystemParametersInfo(SPI_GETWORKAREA, 0, @rectOri, 0);

  // Subtract the rect
  SubtractRect(rect, rectOri, Classes.Rect(Left, Top, Width, Height));

  // Set this to be the new available work area
  SystemParametersInfo(SPI_SETWORKAREA, 0, @rect, 0);
end;

procedure TForm1.FormDestroy(Sender: TObject);
var
  rect: TRect;
begin
  // restore rectOri
  SystemParametersInfo(SPI_SETWORKAREA, 0, @rectOri, 0);
end;

Regards, Geo
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 12676320
I would suggest creating your app as an appbar... see here for code sample: http://www.delphipages.com/tips/thread.cfm?ID=167
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 600 total points
ID: 12676620
I agree with DragonSlayer, an AppBar seems like a thing to do for this, if you do not do an AppBar, you may cover or be covered by an AppBar like Office ToolBar, , , there is also some code for this at EE question -

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20686630.html

if you do not process the AppBar notification messages, then there may be trouble?

0

Featured Post

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!

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

807 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