Board index » cppbuilder » AppBar

AppBar


2007-06-10 01:02:18 AM
cppbuilder56
Hello all
I created a AppBar under BCB 6.0
in private section of header file
APPBARDATA abd;
================
abd.cbSize = sizeof(abd);
abd.hWnd = Handle;
abd.uCallbackMessage = WM_ABNOTIFY;
SHAppBarMessage(ABM_NEW, &abd);
abd.uEdge=ABE_TOP;
SetRect(&abd.rc,0,0,Screen->Width,Screen->Height);
SHAppBarMessage(ABM_QUERYPOS,&abd);
abd.rc.bottom=abd.rc.top+30;
SHAppBarMessage(ABM_SETPOS,&abd);
SetWindowPos(abd.hWnd,HWND_TOPMOST,abd.rc.left,abd.rc.top,
abd.rc.right-abd.rc.left,abd.rc.bottom-abd.rc.top,
SWP_NOMOVE | SWP_NOSIZE);
I placed a form in this area.
How can i implement the auto hide functionality to this form.
 
 

Re:AppBar

"bar" < XXXX@XXXXX.COM >wrote in message
Quote
How can i implement the auto hide functionality to this form.
Look at the ABM_SETAUTOHIDEBAR appbar message.
Gambit
 

Re:AppBar

Hello Remy
In the HIDE button i placed the code.
abd.cbSize = sizeof(abd);
abd.hWnd = frmMain->Handle;
abd.uEdge=ABE_TOP;
abd.lParam = true;
SHAppBarMessage(ABM_SETAUTOHIDEBAR, &abd)
Any wrong with this code.
The function is returning true but no output.
Thanks
SA
 

{smallsort}

Re:AppBar

bar wrote:
Quote
SHAppBarMessage(ABM_SETAUTOHIDEBAR, &abd)

Any wrong with this code.
Are you also doing all the functions in your first message?
Quote
The function is returning true but no output.
What "output" were you expecting?
I would also point out (this shouldn't be a problem)
Quote
abd.lParam = true;
that "true" is a C++ value while "TRUE" is a WinApi value.
 

Re:AppBar

Hello Bob Gonder
Quote
Are you also doing all the functions in your first message?
yes
Quote
>The function is returning true but no output.

What "output" were you expecting?
The space occupied by appbar is not going to the screen edge, the form is
still visible completely.
Quote
I would also point out (this shouldn't be a problem)
>abd.lParam = true;
that "true" is a C++ value while "TRUE" is a WinApi value.
I tried by assigning TRUE but no result.
Thanks
SA
 

Re:AppBar

bar wrote:
Quote
>What "output" were you expecting?

The space occupied by appbar is not going to the screen edge, the form is
still visible completely.
Well, you are telling it to be top-most with your setwindowpos
MS says to use MoveWindow during the startup code, and SetWinfowPos in
response to hiding/showing.
You might try changing to MoveWindow, if that doesn;t work, maybe
using HWND_BOTTOM for the inital position.
Using Application Desktop Toolbars
msdn2.microsoft.com/en-us/library/aa969323.aspx
Are you processing the windows messages WM_ABNOTIFY and checking for
the sub-messages?
Also WM_ACTIVATE WM_WINDOWPOSCHANGED
 

Re:AppBar

Quote
Well, you are telling it to be top-most with your setwindowpos
MS says to use MoveWindow during the startup code, and SetWinfowPos in
response to hiding/showing.
You might try changing to MoveWindow, if that doesn;t work, maybe
using HWND_BOTTOM for the inital position.

Using Application Desktop Toolbars
msdn2.microsoft.com/en-us/library/aa969323.aspx
Hello Bob Gonder thanks for the reply.
In the intial startup code i have
SetWindowPos(abd.hWnd,HWND_BOTTOM,abd.rc.left,abd.rc.top,
abd.rc.right-abd.rc.left,abd.rc.bottom-abd.rc.top,
SWP_NOMOVE | SWP_NOSIZE);
MoveWindow(abd.hWnd,abd.rc.left,abd.rc.top,
abd.rc.right-abd.rc.left,
abd.rc.bottom-abd.rc.top,TRUE);
Quote
Are you processing the windows messages WM_ABNOTIFY and checking for
the sub-messages?
Also WM_ACTIVATE WM_WINDOWPOSCHANGED

No.
 

Re:AppBar

bar wrote:
Quote
>Using Application Desktop Toolbars
>msdn2.microsoft.com/en-us/library/aa969323.aspx

SetWindowPos(abd.hWnd,HWND_BOTTOM,abd.rc.left,abd.rc.top,
abd.rc.right-abd.rc.left,abd.rc.bottom-abd.rc.top,
SWP_NOMOVE | SWP_NOSIZE);
That's an awful lot of code just to set the z order.
I think you should just start over with the code shown in the link I
gave last time.
The first 2 routines show how to set it up.
The last 2 are probably for non-autohide bars, but you might add those
in as well.
 

Re:AppBar

Quote
The last 2 are probably for non-autohide bars, but you might add those
in as well.
Can you pls give detail about the routines or a snip of code.
Thanks
SA
 

Re:AppBar

bar wrote:
Quote
Can you pls give detail about the routines
What detail do you need?
The code is commented.
The documentation for the calls and parameters are only a few clicks
away.
Quote
or a snip of code.
The code is in the link
 

Re:AppBar

The code used to hide the appbar.
abd.uEdge = ABE_TOP;
abd.lParam = TRUE;
abd.cbSize = sizeof(abd);
abd.hWnd = frmMain->Handle;
SHAppBarMessage(ABM_SETAUTOHIDEBAR, &abd);
The function is returning true but appbar is still visible.
Thanks
SA
 

Re:AppBar

Hello all
I am using SHAppBarMessage() function to create appbar.
I have a strange behaviour, i don't at what instance it is happening.
The space i registered for my AppBar is destroying automatically.
I am sure that i am calling the
__fastcall TfrmMain::~TfrmMain()
{
Application->ProcessMessages();
SHAppBarMessage(ABM_REMOVE, &abd);
}
only in the destructor of the form, not anywhere in the program.
1.Does anybody experienced this behaviour, is there anyway to catch the
message ABM_REMOVE and cancel its action.
Thanks in advance.
SA
 

Re:AppBar

I find the instance. it is happening whever a program is{*word*154}, Windows
taskbar and disappears and loads again (something looks refresh)
Any suggestion how to gain the registered appbar space.
Thanks
SA