Menu Bar Problem  
Author Message
Anzelem





PostPosted: Wed Oct 13 01:05:06 CDT 2004 Top

PocketPCDev >> Menu Bar Problem

I have tried using SHCreateMenuBar, I put the following code in the
initdialog method.

SHMENUBARINFO info;
info.cbSize = sizeof(info);
info.hwndParent = m_hWnd;
info.dwFlags = 0;
info.nToolBarId = IDR_MENUBAR1;
info.hInstRes = ::AfxGetInstanceHandle();
info.nBmpId = 0;
info.cBmpImages = 0;
SHCreateMenuBar(&info);

IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
compile the program successfully. However,
I can't
see my menu bar appear at the bottom. Is there anything else I need to
do?
Please help, thanks!

Computer125  
 
 
Vu





PostPosted: Wed Oct 13 01:05:06 CDT 2004 Top

PocketPCDev >> Menu Bar Problem

> I have tried using SHCreateMenuBar, I put the following code in the
> initdialog method.
>
> SHMENUBARINFO info;
> info.cbSize = sizeof(info);
> info.hwndParent = m_hWnd;
> info.dwFlags = 0;
> info.nToolBarId = IDR_MENUBAR1;
> info.hInstRes = ::AfxGetInstanceHandle();
> info.nBmpId = 0;
> info.cBmpImages = 0;
> SHCreateMenuBar(&info);
>
> IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> compile the program successfully. However,
> I can't
> see my menu bar appear at the bottom. Is there anything else I need to
> do?
> Please help, thanks!

My code is almost like yours, except I zero out the whole struct
SHMENUBARINFO before assigning values to its members. This means I zero out
the field clrBk also, while you don't. ( And my menubar displays just fine
:-).

Not sure if it is the problem but it won't hurt to try.

If your InitDialog is not too long, then posting it here may be helpful to
find out the problem.

Vu


 
 
Vu





PostPosted: Wed Oct 13 01:07:04 CDT 2004 Top

PocketPCDev >> Menu Bar Problem



> I have tried using SHCreateMenuBar, I put the following code in the
> initdialog method.
>
> SHMENUBARINFO info;
> info.cbSize = sizeof(info);
> info.hwndParent = m_hWnd;
> info.dwFlags = 0;
> info.nToolBarId = IDR_MENUBAR1;
> info.hInstRes = ::AfxGetInstanceHandle();
> info.nBmpId = 0;
> info.cBmpImages = 0;
> SHCreateMenuBar(&info);
>
> IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> compile the program successfully. However,
> I can't
> see my menu bar appear at the bottom. Is there anything else I need to
> do?
> Please help, thanks!

Have you tried to zero out the field clrBk ?

If your code of InitDialog is not too long , posting it here may be helpful
to find out the problem.

Vu
Vu
 
 
siuming916





PostPosted: Wed Oct 13 01:13:11 CDT 2004 Top

PocketPCDev >> Menu Bar Problem My InitDialog() is as follow. How to zero out the value??


BOOL CFaceRegDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

CenterWindow(GetDesktopWindow()); // center to the hpc screen

// TODO: Add extra initialization here

HANDLE hThread;
DWORD dwThreadID;

hThread = CreateThread(NULL, 0, SockThread, 0, 0, &dwThreadID);
if (hThread == NULL)
MessageBox(_T("Could not create thread"), NULL, MB_OK);
else {
CloseHandle(hThread);
return -1;
}

m_nummatch = 0;
m_image1 = NULL;
m_himage = NULL;
for (int i=0; i<5; i++)
{
m_suspectimage[i] = NULL;
m_hsuspectimage[i] = NULL;
}

SHMENUBARINFO info;
info.cbSize = sizeof(info);
info.hwndParent = m_hWnd;
info.dwFlags = 0;
info.nToolBarId = IDR_MENUBAR1;
info.hInstRes = ::AfxGetInstanceHandle();
info.nBmpId = 0;
info.cBmpImages = 0;
SHCreateMenuBar(&info);


return TRUE; // return TRUE unless you set the focus to a control
}





>
> > I have tried using SHCreateMenuBar, I put the following code in the
> > initdialog method.
> >
> > SHMENUBARINFO info;
> > info.cbSize = sizeof(info);
> > info.hwndParent = m_hWnd;
> > info.dwFlags = 0;
> > info.nToolBarId = IDR_MENUBAR1;
> > info.hInstRes = ::AfxGetInstanceHandle();
> > info.nBmpId = 0;
> > info.cBmpImages = 0;
> > SHCreateMenuBar(&info);
> >
> > IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> > compile the program successfully. However,
> > I can't
> > see my menu bar appear at the bottom. Is there anything else I need to
> > do?
> > Please help, thanks!
>
> Have you tried to zero out the field clrBk ?
>
> If your code of InitDialog is not too long , posting it here may be helpful
> to find out the problem.
>
> Vu
> Vu

 
 
siuming916





PostPosted: Wed Oct 13 01:14:03 CDT 2004 Top

PocketPCDev >> Menu Bar Problem I would like to ask, when I create this project, I select dialog based, not
single document, is it relevant?




>
> > I have tried using SHCreateMenuBar, I put the following code in the
> > initdialog method.
> >
> > SHMENUBARINFO info;
> > info.cbSize = sizeof(info);
> > info.hwndParent = m_hWnd;
> > info.dwFlags = 0;
> > info.nToolBarId = IDR_MENUBAR1;
> > info.hInstRes = ::AfxGetInstanceHandle();
> > info.nBmpId = 0;
> > info.cBmpImages = 0;
> > SHCreateMenuBar(&info);
> >
> > IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> > compile the program successfully. However,
> > I can't
> > see my menu bar appear at the bottom. Is there anything else I need to
> > do?
> > Please help, thanks!
>
> Have you tried to zero out the field clrBk ?
>
> If your code of InitDialog is not too long , posting it here may be helpful
> to find out the problem.
>
> Vu
> Vu

 
 
siuming916





PostPosted: Wed Oct 13 01:20:12 CDT 2004 Top

PocketPCDev >> Menu Bar Problem I have tried to zero out using
memset(&info, 0, sizeof(SHMENUBARINFO));

However, the menu bar still not shown. What should I do?
Can anyone tell me how to do step by step?



> My InitDialog() is as follow. How to zero out the value??
>
> BOOL CFaceRegDlg::OnInitDialog()
> {
> CDialog::OnInitDialog();
>
> // Set the icon for this dialog. The framework does this automatically
> // when the application's main window is not a dialog
> SetIcon(m_hIcon, TRUE); // Set big icon
> SetIcon(m_hIcon, FALSE); // Set small icon
>
> CenterWindow(GetDesktopWindow()); // center to the hpc screen
>
> // TODO: Add extra initialization here
>
> HANDLE hThread;
> DWORD dwThreadID;
>
> hThread = CreateThread(NULL, 0, SockThread, 0, 0, &dwThreadID);
> if (hThread == NULL)
> MessageBox(_T("Could not create thread"), NULL, MB_OK);
> else {
> CloseHandle(hThread);
> return -1;
> }
>
> m_nummatch = 0;
> m_image1 = NULL;
> m_himage = NULL;
> for (int i=0; i<5; i++)
> {
> m_suspectimage[i] = NULL;
> m_hsuspectimage[i] = NULL;
> }
>
> SHMENUBARINFO info;
> info.cbSize = sizeof(info);
> info.hwndParent = m_hWnd;
> info.dwFlags = 0;
> info.nToolBarId = IDR_MENUBAR1;
> info.hInstRes = ::AfxGetInstanceHandle();
> info.nBmpId = 0;
> info.cBmpImages = 0;
> SHCreateMenuBar(&info);
>
> return TRUE; // return TRUE unless you set the focus to a control
> }
>

>

> >
> > > I have tried using SHCreateMenuBar, I put the following code in the
> > > initdialog method.
> > >
> > > SHMENUBARINFO info;
> > > info.cbSize = sizeof(info);
> > > info.hwndParent = m_hWnd;
> > > info.dwFlags = 0;
> > > info.nToolBarId = IDR_MENUBAR1;
> > > info.hInstRes = ::AfxGetInstanceHandle();
> > > info.nBmpId = 0;
> > > info.cBmpImages = 0;
> > > SHCreateMenuBar(&info);
> > >
> > > IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> > > compile the program successfully. However,
> > > I can't
> > > see my menu bar appear at the bottom. Is there anything else I need to
> > > do?
> > > Please help, thanks!
> >
> > Have you tried to zero out the field clrBk ?
> >
> > If your code of InitDialog is not too long , posting it here may be helpful
> > to find out the problem.
> >
> > Vu
> > Vu

 
 
Vu





PostPosted: Wed Oct 13 07:13:02 CDT 2004 Top

PocketPCDev >> Menu Bar Problem

> I would like to ask, when I create this project, I select dialog based, not
> single document, is it relevant?

Yes, my apps often are dialog-based ones with that same way of creating menu
bar.

I know what I say here is silly, but it happened one time for me : when I
created the menubar, I had some problem with displaying it porperly ( it
flashed or something ). Then I delete the whole menu resource ( the
IDR_MENUBAR1 ) and re-create it. After that , it works. Maybe I screwed up
something under my menu definition. But after re-creating it, it works.

Vu

>

>

> >
> > > I have tried using SHCreateMenuBar, I put the following code in the
> > > initdialog method.
> > >
> > > SHMENUBARINFO info;
> > > info.cbSize = sizeof(info);
> > > info.hwndParent = m_hWnd;
> > > info.dwFlags = 0;
> > > info.nToolBarId = IDR_MENUBAR1;
> > > info.hInstRes = ::AfxGetInstanceHandle();
> > > info.nBmpId = 0;
> > > info.cBmpImages = 0;
> > > SHCreateMenuBar(&info);
> > >
> > > IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> > > compile the program successfully. However,
> > > I can't
> > > see my menu bar appear at the bottom. Is there anything else I need to
> > > do?
> > > Please help, thanks!
> >
> > Have you tried to zero out the field clrBk ?
> >
> > If your code of InitDialog is not too long , posting it here may be helpful
> > to find out the problem.
> >
> > Vu
> > Vu
>
>
 
 
r_z_aret





PostPosted: Wed Oct 13 16:55:23 CDT 2004 Top

PocketPCDev >> Menu Bar Problem I'm working on an answer to your _very_ similar question in "How to
create and add menu bar in EVC++ 3.0?"

On Wed, 13 Oct 2004 11:41:00 +0800, ¢«¤p©úCSM¢¨


>I have tried using SHCreateMenuBar, I put the following code in the
>initdialog method.
>
>SHMENUBARINFO info;
>info.cbSize = sizeof(info);
>info.hwndParent = m_hWnd;
>info.dwFlags = 0;
>info.nToolBarId = IDR_MENUBAR1;
>info.hInstRes = ::AfxGetInstanceHandle();
>info.nBmpId = 0;
>info.cBmpImages = 0;
>SHCreateMenuBar(&info);
>
>IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
>compile the program successfully. However,
>I can't
>see my menu bar appear at the bottom. Is there anything else I need to
>do?
>Please help, thanks!
>
>

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

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
 
 
siuming916





PostPosted: Wed Oct 13 20:58:03 CDT 2004 Top

PocketPCDev >> Menu Bar Problem Thanks for your help.
I did it successfully after re-create the menubar.




>
> > I would like to ask, when I create this project, I select dialog based, not
> > single document, is it relevant?
>
> Yes, my apps often are dialog-based ones with that same way of creating menu
> bar.
>
> I know what I say here is silly, but it happened one time for me : when I
> created the menubar, I had some problem with displaying it porperly ( it
> flashed or something ). Then I delete the whole menu resource ( the
> IDR_MENUBAR1 ) and re-create it. After that , it works. Maybe I screwed up
> something under my menu definition. But after re-creating it, it works.
>
> Vu
>
> >

> >

> > >
> > > > I have tried using SHCreateMenuBar, I put the following code in the
> > > > initdialog method.
> > > >
> > > > SHMENUBARINFO info;
> > > > info.cbSize = sizeof(info);
> > > > info.hwndParent = m_hWnd;
> > > > info.dwFlags = 0;
> > > > info.nToolBarId = IDR_MENUBAR1;
> > > > info.hInstRes = ::AfxGetInstanceHandle();
> > > > info.nBmpId = 0;
> > > > info.cBmpImages = 0;
> > > > SHCreateMenuBar(&info);
> > > >
> > > > IDR_MENUBAR1 is the menu bar I insert in the resourse view. I can
> > > > compile the program successfully. However,
> > > > I can't
> > > > see my menu bar appear at the bottom. Is there anything else I need to
> > > > do?
> > > > Please help, thanks!
> > >
> > > Have you tried to zero out the field clrBk ?
> > >
> > > If your code of InitDialog is not too long , posting it here may be helpful
> > > to find out the problem.
> > >
> > > Vu
> > > Vu
> >
> >