Print Page | Close Window

CXTPCommandBars on glitch on NT

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1045
Printed Date: 06 November 2025 at 9:00am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPCommandBars on glitch on NT
Posted By: plamen
Subject: CXTPCommandBars on glitch on NT
Date 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);
}



Replies:
Posted By: Oleg
Date 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


Posted By: plamen
Date 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

uploads/plamen/2004-08-11_022548_testpopup.zip - 2004-08-11_022548_testpopup.zip


Posted By: Oleg
Date 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


Posted By: plamen
Date 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.



Posted By: Sven
Date 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};
        ...
}



Posted By: plamen
Date 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


Posted By: Sven
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net