Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPCommandBars on glitch on NT
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPCommandBars on glitch on NT

 Post Reply Post Reply
Author
Message
plamen View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote plamen Quote  Post ReplyReply Direct Link To This Post Topic: CXTPCommandBars on glitch on NT
    Posted: 10 August 2004 at 9:05am
Guys,
I noticed a small problem with CXTPCommandBars on Windows NT.
It looks like if you create a pop-up a menu with some items disabled, on NT displays them enabled instead. However, it looks like it works fine on XP.

To reproduce it build a standard MDI application and add the code below into the view.

Cheers,
Plamen



void CTest2View::OnRButtonDown(UINT nFlags, CPoint point)
{
     ClientToScreen( &point );
     CMenu menu;
     menu.LoadMenu(IDR_POPUPMENU);
     menu.GetSubMenu(0)->EnableM enuItem(ID_POPUP_DISABLED, MF_BYCOMMAND | MF_DISABLED);
     UINT iCmdID = CXTPCommandBars::TrackPopupMenu(menu.GetSubMenu(0), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, AfxGetMainWnd(), NULL);

     if (iCmdID == ID_POPUP_DISABLED)
           AfxMessageBox(L"This menu should be disabled...");
     
     CView::OnRButtonDown(nFlags, point);
}
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2004 at 2:17am

Strange, I can't reproduce it in my NT4 machine :(

Can you upload your example?

Can you manually debug CXTPCommandBar::LoadMenu and check if info.fState == MFS_DISABLED for ID_POPUP_DISABLED?

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
plamen View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote plamen Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2004 at 2:26am
Oleg,
I use a clean NT4 Service Pack 6 / IE 5.5.

Find the sample attached.

Cheers,
Plamen

2004-08-11_022548_testpopup.zip
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2004 at 12:24pm

Can't reproduce with nt4 sp6.

 

May be in nt4 you have version earlier than 9.00?

TPM_NONOTIFY  appeared in 9.00...

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
plamen View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote plamen Quote  Post ReplyReply Direct Link To This Post Posted: 13 August 2004 at 6:53am
I use the latest - v9.10
Anyway, if you still can't reproduce it I'll dive into your code to find some more info about it.

Back to Top
Sven View Drop Down
Senior Member
Senior Member


Joined: 21 August 2003
Location: Germany
Status: Offline
Points: 127
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sven Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2004 at 1:42pm

Since NT4/W95 the size of MENUITEMINFO has been changed. If you compile the toolkit with the latest Platform SDK and WINVER >= 0x0500 you have to adjust the MENUITEMINFO size in CXTPCommandBar::LoadMenu.


#if (WINVER >= 0x0500)
#define MENUITEMINFO_SIZE_VERSION_400A  CDSIZEOF_STRUCT(MENUITEMINFOA, cch)
#define MENUITEMINFO_SIZE_VERSION_400W  CDSIZEOF_STRUCT(MENUITEMINFOW, cch)
#define MENUITEMINFO_SIZE_VERSION_500A  sizeof(MENUITEMINFOA)
#define MENUITEMINFO_SIZE_VERSION_500W  sizeof(MENUITEMINFOW)
#ifdef UNICODE
#define MENUITEMINFO_SIZE_VERSION_400  MENUITEMINFO_SIZE_VERSION_400W
#define MENUITEMINFO_SIZE_VERSION_500  MENUITEMINFO_SIZE_VERSION_500W
#else
#define MENUITEMINFO_SIZE_VERSION_400  MENUITEMINFO_SIZE_VERSION_400A
#define MENUITEMINFO_SIZE_VERSION_500  MENUITEMINFO_SIZE_VERSION_500A
#endif
#endif

#define MENUITEMINFO_SIZE  MENUITEMINFO_SIZE_VERSION_400

BOOL CXTPCommandBar::LoadMenu(CMenu* pMenu, BOOL bRemoveControls)
{
        ...
//      MENUITEMINFO info = { sizeof(MENUITEMINFO), MIIM_TYPE|MIIM_STATE};
        MENUITEMINFO info = { MENUITEMINFO_SIZE, MIIM_TYPE|MIIM_STATE};
        ...
}

Back to Top
plamen View Drop Down
Newbie
Newbie


Joined: 10 August 2004
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote plamen Quote  Post ReplyReply Direct Link To This Post Posted: 16 August 2004 at 10:58am
Sven,
Thanks for your reply.
What I don't understand is how the new MENUITEMINFO size could affect the state of the menu under NT - fState field is part of the NT's MENUITEMINFO as well.
I can imagine that some of the new added flags/fields may not work on NT but, hey, that's why there weren't part of the original NT structure.

Btw does this mean that you've managed to reproduce it and fixed it that way?

Cheers
Plamen
Back to Top
Sven View Drop Down
Senior Member
Senior Member


Joined: 21 August 2003
Location: Germany
Status: Offline
Points: 127
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sven Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2004 at 3:27am

NT4 compares the size you specify in MENUITEMINFO.cbSize with the size of the old MENUITEMINFO size. If the size is not equal the function returns with an error code and the values of MENUITEMINFO remain uninitialized. You can test this if you set a breakpoint in CXTPCommandBar::LoadMenu.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.051 seconds.