Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: integer displayed instead of string Pin
lordmickel25-Sep-04 10:45
lordmickel25-Sep-04 10:45 
GeneralString editing using Borland C++ and AIX in Linux Pin
youngashish24-Sep-04 12:09
youngashish24-Sep-04 12:09 
GeneralRe: String editing using Borland C++ and AIX in Linux Pin
Aamir Butt24-Sep-04 20:13
Aamir Butt24-Sep-04 20:13 
GeneralRe: String editing using Borland C++ and AIX in Linux Pin
Anonymous25-Sep-04 11:05
Anonymous25-Sep-04 11:05 
QuestionGetMenuItemInfo didn't work in WinNT 4.0, why? Pin
Cyrus Dang24-Sep-04 11:50
Cyrus Dang24-Sep-04 11:50 
AnswerRe: GetMenuItemInfo didn't work in WinNT 4.0, why? Pin
David Crow24-Sep-04 12:07
David Crow24-Sep-04 12:07 
AnswerRe: GetMenuItemInfo didn't work in WinNT 4.0, why? Pin
Michael Dunn24-Sep-04 12:34
sitebuilderMichael Dunn24-Sep-04 12:34 
GeneralRe: GetMenuItemInfo didn't work in WinNT 4.0, why? Pin
Cyrus Dang24-Sep-04 12:56
Cyrus Dang24-Sep-04 12:56 
Some lines of simple code:

////////////////////////////////////////////////////////////////<br />
MENUITEMINFO mmi, temp;<br />
ZeroMemory(&mmi,sizeof(mmi));<br />
mmi.cbSize = sizeof(mmi);<br />
// Assign user data to menu item<br />
mmi.fMask = MIIM_DATA;<br />
mmi.dwItemData = (DWORD) pData;<br />
::SetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &mmi);<br />
// Try getting the data back for testing purpose<br />
temp.cbSize = sizeof(MENUITEMINFO);<br />
temp.fMask = MIIM_DATA;<br />
BOOL rc = ::GetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &temp);<br />
if (!rc) {<br />
int iErrCode = GetLastError();  // iErrCode will be 87<br />
}

When waiting for your replies, I found that the function GetMenuItemInfo will work properly in WinNT if (cbSize==sizeof(MENUITEMINFO) - 4). I think the problem is somewhere around the WINVER. In WinUser.h I saw these:

typedef struct tagMENUITEMINFOW<br />
{<br />
    UINT     cbSize;<br />
    UINT     fMask;<br />
    UINT     fType;         // used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0)<br />
    UINT     fState;        // used if MIIM_STATE<br />
    UINT     wID;           // used if MIIM_ID<br />
    HMENU    hSubMenu;      // used if MIIM_SUBMENU<br />
    HBITMAP  hbmpChecked;   // used if MIIM_CHECKMARKS<br />
    HBITMAP  hbmpUnchecked; // used if MIIM_CHECKMARKS<br />
    ULONG_PTR dwItemData;   // used if MIIM_DATA<br />
    LPWSTR   dwTypeData;    // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)<br />
    UINT     cch;           // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)<br />
#if(WINVER >= 0x0500)<br />
    HBITMAP  hbmpItem;      // used if MIIM_BITMAP<br />
#endif<br />
}


So, I think the function GetMenuItemInfo failed in Windows NT because of the size of returned variable LPMENUITEMINFO(&temp). GetMenuItemInfo expected to see the size of returned variable is 44. However, sizeof(MENUITEMINFO) returned 48. In my opinion, this caused the error. Anyway, thanks for your replies.

____
Tuan
GeneralBypassing Declarative Security Pin
Chef Jeff24-Sep-04 11:40
sussChef Jeff24-Sep-04 11:40 
QuestionHow to change wchar string to CString easily Pin
sixiang24-Sep-04 11:12
sixiang24-Sep-04 11:12 
AnswerRe: How to change wchar string to CString easily Pin
Alexander M.,24-Sep-04 12:35
Alexander M.,24-Sep-04 12:35 
GeneralRe: How to change wchar string to CString easily Pin
sixiang24-Sep-04 13:49
sixiang24-Sep-04 13:49 
GeneralRe: How to change wchar string to CString easily Pin
Alexander M.,25-Sep-04 0:20
Alexander M.,25-Sep-04 0:20 
AnswerRe: How to change wchar string to CString easily Pin
Michael Dunn24-Sep-04 12:36
sitebuilderMichael Dunn24-Sep-04 12:36 
General#define SOMETHING in new configuration type Pin
BlackDice24-Sep-04 9:09
BlackDice24-Sep-04 9:09 
GeneralRESOLVED Pin
BlackDice24-Sep-04 9:32
BlackDice24-Sep-04 9:32 
QuestionHow to go about this... Pin
mirano24-Sep-04 9:04
mirano24-Sep-04 9:04 
AnswerRe: How to go about this... Pin
Henry miller24-Sep-04 10:20
Henry miller24-Sep-04 10:20 
AnswerRe: How to go about this... Pin
Neville Franks24-Sep-04 12:29
Neville Franks24-Sep-04 12:29 
AnswerRe: How to go about this... Pin
cmk24-Sep-04 13:35
cmk24-Sep-04 13:35 
AnswerRe: How to go about this... Pin
mirano24-Sep-04 23:58
mirano24-Sep-04 23:58 
Generalvalue duplication issue Pin
Paul Swet24-Sep-04 8:39
Paul Swet24-Sep-04 8:39 
GeneralRe: value duplication issue Pin
David Crow24-Sep-04 8:54
David Crow24-Sep-04 8:54 
GeneralRe: value duplication issue Pin
Arsalan Malik24-Sep-04 18:57
Arsalan Malik24-Sep-04 18:57 
GeneralRe: value duplication issue Pin
Paul Swet24-Sep-04 21:41
Paul Swet24-Sep-04 21:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.