jabubo
asked on
Creating an AppBar for a ticker
Hello,
i try to create a simple newsticker and for this it would be glad, when the windows is on top of my desktop or bottom, wherever i want.
i've found in the MSDN the Appbar Messages and Functions, but there is much trouble with it for me :/
BarData : TAppBarData;
with BarData do begin
cbSize := SizeOf(BarData);
hwnd := Ticker.Handle;
uCallBackMessage := WM_USER;
uEdge := ABE_TOP;
rc := Rect( 0 , 0 , screen.width , 30 );
lParam := 0;
end;
This is how my AppBar Structure looks like.
The Problem with this code is, when i run the Form, the window is just half the screen wide and behind some other appbars.
SHAppBarMessage(ABM_QUERYP OS, BarData); <-- this returns evertime true, MSDN says, so i dont know how to check if there is any appbar in this location of my desktop.
Can someone help find the right positon and size for my ticker ?
Is there something to remember when i reposition the ticker from top to bottom ?
Thanks for help anyway
i try to create a simple newsticker and for this it would be glad, when the windows is on top of my desktop or bottom, wherever i want.
i've found in the MSDN the Appbar Messages and Functions, but there is much trouble with it for me :/
BarData : TAppBarData;
with BarData do begin
cbSize := SizeOf(BarData);
hwnd := Ticker.Handle;
uCallBackMessage := WM_USER;
uEdge := ABE_TOP;
rc := Rect( 0 , 0 , screen.width , 30 );
lParam := 0;
end;
This is how my AppBar Structure looks like.
The Problem with this code is, when i run the Form, the window is just half the screen wide and behind some other appbars.
SHAppBarMessage(ABM_QUERYP
Can someone help find the right positon and size for my ticker ?
Is there something to remember when i reposition the ticker from top to bottom ?
Thanks for help anyway
ASKER
Hello Slick812,
The window appears now in the reserved area and the appbar is registered. But i have not found any way to set the top and left position to the right value, so that other appbars ( MS-Office Bar, Newsticker, Taskbar .... ) are not at the same coordiantes. Now my Appbar is over an other appbar.
When you could help me with this, points are yours ;)
thanks for help so far.
The window appears now in the reserved area and the appbar is registered. But i have not found any way to set the top and left position to the right value, so that other appbars ( MS-Office Bar, Newsticker, Taskbar .... ) are not at the same coordiantes. Now my Appbar is over an other appbar.
When you could help me with this, points are yours ;)
thanks for help so far.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would like to suggest that you set the form align to
top or bottom
i hope this will solve your problem...
:D
top or bottom
i hope this will solve your problem...
:D
ASKER
Hi,
Sorry for the delay!
this helps a little bit, but when i write:
BarData1.rc.Left := 0;
BarData1.rc.Top := 0;
the bar only will be on top of desktop, but there could be another bar. So i need a top and left value, that sets the size of the rest of the desktop. With maximizing the window, geht top and left value, and resize to normal and so on, id wouldn't work :/
hope that you know what i mean and that you can help me.
Sorry for my excellent english ;)
Thanks for help
Sorry for the delay!
this helps a little bit, but when i write:
BarData1.rc.Left := 0;
BarData1.rc.Top := 0;
the bar only will be on top of desktop, but there could be another bar. So i need a top and left value, that sets the size of the rest of the desktop. With maximizing the window, geht top and left value, and resize to normal and so on, id wouldn't work :/
hope that you know what i mean and that you can help me.
Sorry for my excellent english ;)
Thanks for help
??????
what are you talking about?
the code
BarData1.rc.Left := 0;
BarData1.rc.Top := 0;
does Nothing, later you call
ShAppBarMessage(ABM_QUERYP OS, BarData1);
which accually sets the BarData1.rc to the "NEW" position under any other AppBar on the top
or it changes the rc.Left, if there is an AppBar on the left, then
{I set the rc. bottom here, but if it is the ABE_BOTTOM then
you would set the rc.Top, and rc.Left for ABE_RIGHT
and rc.Right for ABE_Left}
BarData1.rc.Bottom := BarData1.rc.Top+Height;
you need to set the height of the rc rect
and then
ShAppBarMessage(ABM_SETPOS , BarData1);
will further adjust the rc Rect, and set your AppBar position, I tried this with other AppBars and it repositioned
to Under others on top or Over others on the bottom, it works for me in Win98 and WinXP
what are you talking about?
the code
BarData1.rc.Left := 0;
BarData1.rc.Top := 0;
does Nothing, later you call
ShAppBarMessage(ABM_QUERYP
which accually sets the BarData1.rc to the "NEW" position under any other AppBar on the top
or it changes the rc.Left, if there is an AppBar on the left, then
{I set the rc. bottom here, but if it is the ABE_BOTTOM then
you would set the rc.Top, and rc.Left for ABE_RIGHT
and rc.Right for ABE_Left}
BarData1.rc.Bottom := BarData1.rc.Top+Height;
you need to set the height of the rc rect
and then
ShAppBarMessage(ABM_SETPOS
will further adjust the rc Rect, and set your AppBar position, I tried this with other AppBars and it repositioned
to Under others on top or Over others on the bottom, it works for me in Win98 and WinXP
ASKER
hmm, there must be some errors in my code, with your code from above it works.
Thanks for your help!!!
Thanks for your help!!!
procedure TForm1.FormCreate(Sender: TObject);
var
MenuRect: Trect;
begin
GetMenuItemRect(Handle,Mai
Height := MenuRect.Bottom - MenuRect.Top;
BarData1.cbSize := SizeOf (TAppBarData);
BarData1.uEdge := ABE_TOP;
BarData1.lParam := 0;
BarData1.uCallbackMessage := WM_MyUser;
BarData1.rc.Left := 0;
BarData1.rc.Top := 0;
BarData1.rc.Right := GetSystemMetrics(SM_CXSCRE
BarData1.rc.Bottom := Height;
BarData1.hWnd := Handle;
ShAppBarMessage(ABM_NEW, BarData1);
ShAppBarMessage(ABM_QUERYP
BarData1.rc.Bottom := BarData1.rc.Top+Height;
ShAppBarMessage(ABM_SETPOS
SetBounds(BarData1.rc.Left
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShAppBarMessage(ABM_REMOVE
end;
- - - - - - - - - - - - - - - - - - - - - - --
ask questions if you need more info