Just writing a sample on WM 5.0 - PocketPC,

Have created a MFC Dialog based(.exe) using the VS2005 project wizard,
and created a menu(IDR_MENU1) in the ResourceView.
And tried adding a menubar to the Dialog using the following code,

Declared the 'CCommandBar m_cmdBar;' in the Dialog Class
and in the InitDialog() of the Dialog,
m_cmdBar.Create(this);
m_cmdBar.InsertMenuBar(IDR_MENU1);

But it is not displaying the Menubar.

Any help would be appreciated.

Regards,
Bhupathi.

Re: MenuBar not getting displayed on CDialog - WM 5.0 by Ilya

Ilya
Wed Nov 02 01:46:23 CST 2005

CDialog class already has a empty menu called m_pWndEmptyCB.
You may change your code -

CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
pCommandBar->InsertMenuBar(IDR_MENU1);

For more information about creatino menu in MFC check this article -
http://www.pocketpcdn.com/articles/dialogmenu.html

"Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
news:8419288A-15D8-40AC-B3E8-F5BAB8C6C778@microsoft.com...
> Just writing a sample on WM 5.0 - PocketPC,
>
> Have created a MFC Dialog based(.exe) using the VS2005 project wizard,
> and created a menu(IDR_MENU1) in the ResourceView.
> And tried adding a menubar to the Dialog using the following code,
>
> Declared the 'CCommandBar m_cmdBar;' in the Dialog Class
> and in the InitDialog() of the Dialog,
> m_cmdBar.Create(this);
> m_cmdBar.InsertMenuBar(IDR_MENU1);
>
> But it is not displaying the Menubar.
>
> Any help would be appreciated.
>
> Regards,
> Bhupathi.
>
>
>
>
>
>



Re: MenuBar not getting displayed on CDialog - WM 5.0 by Bhupathi

Bhupathi
Wed Nov 02 04:30:03 CST 2005

m_pWndEmptyCB is removed from the CDialog in the WindowsMobile5.0.
The following code working fine with PPC2003 but not with PPC2005.
> > m_cmdBar.Create(this);
> > m_cmdBar.InsertMenuBar(IDR_MENU1);

Any help would be appreciated.

Regards,
Bhupathi.

"Ilya Manin" wrote:

> CDialog class already has a empty menu called m_pWndEmptyCB.
> You may change your code -
>
> CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
> pCommandBar->InsertMenuBar(IDR_MENU1);
>
> For more information about creatino menu in MFC check this article -
> http://www.pocketpcdn.com/articles/dialogmenu.html
>
> "Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
> news:8419288A-15D8-40AC-B3E8-F5BAB8C6C778@microsoft.com...
> > Just writing a sample on WM 5.0 - PocketPC,
> >
> > Have created a MFC Dialog based(.exe) using the VS2005 project wizard,
> > and created a menu(IDR_MENU1) in the ResourceView.
> > And tried adding a menubar to the Dialog using the following code,
> >
> > Declared the 'CCommandBar m_cmdBar;' in the Dialog Class
> > and in the InitDialog() of the Dialog,
> > m_cmdBar.Create(this);
> > m_cmdBar.InsertMenuBar(IDR_MENU1);
> >
> > But it is not displaying the Menubar.
> >
> > Any help would be appreciated.
> >
> > Regards,
> > Bhupathi.
> >
> >
> >
> >
> >
> >
>
>
>

Re: MenuBar not getting displayed on CDialog - WM 5.0 by Ilya

Ilya
Thu Nov 03 00:22:51 CST 2005

Try to use this code -



SHMENUBARINFO mbi;

ZeroMemory(&mbi, sizeof(SHMENUBARINFO));

mbi.cbSize = sizeof(SHMENUBARINFO);

mbi.hwndParent = GetSafeHwnd();

mbi.hInstRes = AfxGetResourceHandle();

mbi.dwFlags = SHCMBF_HMENU;

mbi.nToolBarId = IDR_MENU1;

nRes = AYGSHELL::SHCreateMenuBar(&mbi);


or manualy add RCDATA resource for your menu
--
Best Regards
Ilya Manin

"Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
news:95ED204F-993A-4DD5-B9EA-627E84356864@microsoft.com...
> m_pWndEmptyCB is removed from the CDialog in the WindowsMobile5.0.
> The following code working fine with PPC2003 but not with PPC2005.
>> > m_cmdBar.Create(this);
>> > m_cmdBar.InsertMenuBar(IDR_MENU1);
>
> Any help would be appreciated.
>
> Regards,
> Bhupathi.
>
> "Ilya Manin" wrote:
>
>> CDialog class already has a empty menu called m_pWndEmptyCB.
>> You may change your code -
>>
>> CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
>> pCommandBar->InsertMenuBar(IDR_MENU1);
>>
>> For more information about creatino menu in MFC check this article -
>> http://www.pocketpcdn.com/articles/dialogmenu.html
>>
>> "Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
>> news:8419288A-15D8-40AC-B3E8-F5BAB8C6C778@microsoft.com...
>> > Just writing a sample on WM 5.0 - PocketPC,
>> >
>> > Have created a MFC Dialog based(.exe) using the VS2005 project
>> > wizard,
>> > and created a menu(IDR_MENU1) in the ResourceView.
>> > And tried adding a menubar to the Dialog using the following code,
>> >
>> > Declared the 'CCommandBar m_cmdBar;' in the Dialog Class
>> > and in the InitDialog() of the Dialog,
>> > m_cmdBar.Create(this);
>> > m_cmdBar.InsertMenuBar(IDR_MENU1);
>> >
>> > But it is not displaying the Menubar.
>> >
>> > Any help would be appreciated.
>> >
>> > Regards,
>> > Bhupathi.
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>>



Re: MenuBar not getting displayed on CDialog - WM 5.0 by Bhupathi

Bhupathi
Thu Nov 03 23:19:03 CST 2005

got the menubar displayed with your code. Thanks.

Regards,
Bhupathi.


"Ilya Manin" wrote:

> Try to use this code -
>
>
>
> SHMENUBARINFO mbi;
>
> ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
>
> mbi.cbSize = sizeof(SHMENUBARINFO);
>
> mbi.hwndParent = GetSafeHwnd();
>
> mbi.hInstRes = AfxGetResourceHandle();
>
> mbi.dwFlags = SHCMBF_HMENU;
>
> mbi.nToolBarId = IDR_MENU1;
>
> nRes = AYGSHELL::SHCreateMenuBar(&mbi);
>
>
> or manualy add RCDATA resource for your menu
> --
> Best Regards
> Ilya Manin
>
> "Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
> news:95ED204F-993A-4DD5-B9EA-627E84356864@microsoft.com...
> > m_pWndEmptyCB is removed from the CDialog in the WindowsMobile5.0.
> > The following code working fine with PPC2003 but not with PPC2005.
> >> > m_cmdBar.Create(this);
> >> > m_cmdBar.InsertMenuBar(IDR_MENU1);
> >
> > Any help would be appreciated.
> >
> > Regards,
> > Bhupathi.
> >
> > "Ilya Manin" wrote:
> >
> >> CDialog class already has a empty menu called m_pWndEmptyCB.
> >> You may change your code -
> >>
> >> CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
> >> pCommandBar->InsertMenuBar(IDR_MENU1);
> >>
> >> For more information about creatino menu in MFC check this article -
> >> http://www.pocketpcdn.com/articles/dialogmenu.html
> >>
> >> "Bhupathi" <Bhupathi@discussions.microsoft.com> wrote in message
> >> news:8419288A-15D8-40AC-B3E8-F5BAB8C6C778@microsoft.com...
> >> > Just writing a sample on WM 5.0 - PocketPC,
> >> >
> >> > Have created a MFC Dialog based(.exe) using the VS2005 project
> >> > wizard,
> >> > and created a menu(IDR_MENU1) in the ResourceView.
> >> > And tried adding a menubar to the Dialog using the following code,
> >> >
> >> > Declared the 'CCommandBar m_cmdBar;' in the Dialog Class
> >> > and in the InitDialog() of the Dialog,
> >> > m_cmdBar.Create(this);
> >> > m_cmdBar.InsertMenuBar(IDR_MENU1);
> >> >
> >> > But it is not displaying the Menubar.
> >> >
> >> > Any help would be appreciated.
> >> >
> >> > Regards,
> >> > Bhupathi.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
>
>
>