Click here to get back home

how to hide command bar

 HomeNewsGroups | Search | About
 microsoft.public.smartphone.developer    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
how to hide command bar Dan 07-30-2008
Get Chitika Premium
Posted by Dan on July 30, 2008, 5:41 pm
Please log in for more thread options
Hi,

I create a dialog named MyDialog from a parent window and I want to use
the command bar of parent window, not the command bar of MyDialog. It
works fine at beginning when the dialog is created. But when I tap at
the dialog, the command bar of parent window disappears and I'm not able
to bring it back. I have tried to use following function to hide command
bar of MyDialog without success:

::CommandBar_Show(m_hWnd, FALSE);

And

SetForegroundWindow();
SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);

// Resize the window.        
RECT rc;
SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN));
MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
        

Please help me to resolve this issue.

Thank you very much,

Dan

Posted by r_z_aret on July 31, 2008, 3:14 pm
Please log in for more thread options

>Hi,
>
>I create a dialog named MyDialog from a parent window and I want to use
>the command bar of parent window, not the command bar of MyDialog. It
>works fine at beginning when the dialog is created. But when I tap at
>the dialog, the command bar of parent window disappears and I'm not able
>to bring it back. I have tried to use following function to hide command
>bar of MyDialog without success:

Why are you creating a menu/command bar at all for MyDialog? If you
don't create one, you won't have to hide it.

>
>::CommandBar_Show(m_hWnd, FALSE);
>
>And
>
>SetForegroundWindow();
>SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
>
>// Resize the window.        
>RECT rc;
>SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN),
>GetSystemMetrics(SM_CYSCREEN));

SM_CYSCREEN gives the height of the whole screen, including the
menu/command bar. So you are making MyDialog big enough to cover up
the menu/command bar. I think you need to subtract the height of the
menu/command bar. I've found that to be 24 for Smartphone/Standard,
and GetSystemMetrics( SM_CYMENU ) for other platforms. Or you can use
SystemParametersInfo with SPI_GETWORKAREA to get the dimensions you
want directly.

>MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
>        
>
>Please help me to resolve this issue.
>
>Thank you very much,
>
>Dan

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please
indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Posted by Dan on August 1, 2008, 10:51 am
Please log in for more thread options
Thanks for your responding. I did try to subtract the height of the
menu/command bar, but it came the same result. I'm not creating any
menu/command bar in MyDialog. When MyDialog is tapped, an empty menu bar
always covers the command bar of parent window. I also try to get HWND
of parent command bar and it returns NULL value. I have no way to bring
the command bar of parent window back once it disappears.

Thanks,

Dan

r_z_aret@pen_fact.com wrote:
>
>> Hi,
>>
>> I create a dialog named MyDialog from a parent window and I want to use
>> the command bar of parent window, not the command bar of MyDialog. It
>> works fine at beginning when the dialog is created. But when I tap at
>> the dialog, the command bar of parent window disappears and I'm not able
>> to bring it back. I have tried to use following function to hide command
>> bar of MyDialog without success:
>
> Why are you creating a menu/command bar at all for MyDialog? If you
> don't create one, you won't have to hide it.
>
>> ::CommandBar_Show(m_hWnd, FALSE);
>>
>> And
>>
>> SetForegroundWindow();
>> SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
>>
>> // Resize the window.        
>> RECT rc;
>> SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN),
>> GetSystemMetrics(SM_CYSCREEN));
>
> SM_CYSCREEN gives the height of the whole screen, including the
> menu/command bar. So you are making MyDialog big enough to cover up
> the menu/command bar. I think you need to subtract the height of the
> menu/command bar. I've found that to be 24 for Smartphone/Standard,
> and GetSystemMetrics( SM_CYMENU ) for other platforms. Or you can use
> SystemParametersInfo with SPI_GETWORKAREA to get the dimensions you
> want directly.
>
>> MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
>>         
>>
>> Please help me to resolve this issue.
>>
>> Thank you very much,
>>
>> Dan
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please
indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 20 Park Plaza, Suite 478
> Boston, MA 02116
> www.penfact.com

Posted by r_z_aret on August 1, 2008, 1:06 pm
Please log in for more thread options

>Thanks for your responding. I did try to subtract the height of the
>menu/command bar, but it came the same result. I'm not creating any
>menu/command bar in MyDialog. When MyDialog is tapped, an empty menu bar
>always covers the command bar of parent window. I also try to get HWND
>of parent command bar and it returns NULL value. I have no way to bring
>the command bar of parent window back once it disappears.

Now I'm confused, so let me take some time to clarify.

I don't call anything a command bar. I assume you mean the bar that's
at the bottom of a Smartphone (AKA Windows Mobile Standard) screen and
contains the menus. I usually call it the menu bar, but I may be
wrong.

I think you have one app with a dialog box, and it opens a child
dialog box you call MyDialog. When MyDialog opens, the menu/command
bar disappears.

Now I'll try to add some actual info.

I have several apps with a main dialog box that opens children. And
the original menu/command bar shows for all of them. I think the only
thing I needed to do was make sure none of the child dialog boxes hid
the menu/command bar. I gave you some hints on that.

If you _do_ find a need to hide or show the menu/command bar, you can
use ShowWindow. The only "tricks" are to use the HWND stored in the
hwndMB member of the SHMENUBARINFO structure you used when you called
SHCreateMenu for the parent dialog box. You may need to call
InvalidateRect first; my code does, but I'm not sure it's necessary.
And you may need to update the desktop window, although I don't.

I tried using SHFindMenuBar, but think that works only when the
menu/command bar is visible.

>
>Thanks,
>
>Dan
>
>r_z_aret@pen_fact.com wrote:
>>
>>> Hi,
>>>
>>> I create a dialog named MyDialog from a parent window and I want to use
>>> the command bar of parent window, not the command bar of MyDialog. It
>>> works fine at beginning when the dialog is created. But when I tap at
>>> the dialog, the command bar of parent window disappears and I'm not able
>>> to bring it back. I have tried to use following function to hide command
>>> bar of MyDialog without success:
>>
>> Why are you creating a menu/command bar at all for MyDialog? If you
>> don't create one, you won't have to hide it.
>>
>>> ::CommandBar_Show(m_hWnd, FALSE);
>>>
>>> And
>>>
>>> SetForegroundWindow();
>>> SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
>>>
>>> // Resize the window.        
>>> RECT rc;
>>> SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN),
>>> GetSystemMetrics(SM_CYSCREEN));
>>
>> SM_CYSCREEN gives the height of the whole screen, including the
>> menu/command bar. So you are making MyDialog big enough to cover up
>> the menu/command bar. I think you need to subtract the height of the
>> menu/command bar. I've found that to be 24 for Smartphone/Standard,
>> and GetSystemMetrics( SM_CYMENU ) for other platforms. Or you can use
>> SystemParametersInfo with SPI_GETWORKAREA to get the dimensions you
>> want directly.
>>
>>> MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
>>>         
>>>
>>> Please help me to resolve this issue.
>>>
>>> Thank you very much,
>>>
>>> Dan
>>
>> -----------------------------------------
>> To reply to me, remove the underscores (_) from my email address (and please
indicate which newsgroup and message).
>>
>> Robert E. Zaret, eMVP
>> PenFact, Inc.
>> 20 Park Plaza, Suite 478
>> Boston, MA 02116
>> www.penfact.com

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please
indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Similar ThreadsPosted
Hide file August 4, 2005, 4:45 am
Is it possible to hide scrollbar? August 21, 2006, 5:52 am
Hide / Show November 24, 2006, 2:47 pm
hide menubar January 26, 2007, 5:47 am
OMA DM and the Exec command in WM5/WM6 February 14, 2007, 4:30 pm
Voice Command for Treo700w March 10, 2006, 11:09 am
command line tool April 20, 2007, 5:29 pm
How to add bitmap to command bar background? April 15, 2008, 7:05 am
How to add bitmap to command bar background? April 15, 2008, 7:05 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap