Click here to Skip to main content
16,008,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Same code takes different times!! Pin
Alan Balkany19-Jun-08 3:22
Alan Balkany19-Jun-08 3:22 
QuestionWinSock Remote Connection Pin
Knight Rider16-Jun-08 11:29
Knight Rider16-Jun-08 11:29 
Questionwin32 user-drawn menus Pin
greghint16-Jun-08 6:33
greghint16-Jun-08 6:33 
AnswerRe: win32 user-drawn menus Pin
James R. Twine16-Jun-08 8:01
James R. Twine16-Jun-08 8:01 
GeneralRe: win32 user-drawn menus Pin
greghint16-Jun-08 9:25
greghint16-Jun-08 9:25 
GeneralRe: win32 user-drawn menus Pin
zildjohn0117-Jun-08 2:09
zildjohn0117-Jun-08 2:09 
GeneralRe: win32 user-drawn menus Pin
greghint17-Jun-08 9:35
greghint17-Jun-08 9:35 
GeneralRe: win32 user-drawn menus [modified] Pin
greghint18-Jun-08 8:00
greghint18-Jun-08 8:00 
I totally restructured my code in order to simplify things and try to track down what is wrong. My menu is now generated after getting the WM_CREATE message rather than dynamically when the user clicks for simplicity's sake. Each object is created using the new operator and destroyed using delete after receiving the WM_DESTROY message. I implemented a linked list and wrote a function to iterate through them at any time during the program's execution. The objects are all accessible. Since the LPDRAWITEMSTRUCT->itemData didn't seem to ever contain a valid pointer to my info, I now use my own function to retrieve my item data, and no longer load a pointer onto the dwItemData member of MENUITEMINFO.

My application is now drawing the menu for regular menu items: hooray! But I am still getting a nasty crash bug when the item being drawn is a submenu. In the class constructor, if an item is a submenu, an HMENU object is created and assigned to a member variable. The submenu is then created using the following code:

AppendMenu(myMenu, MF_POPUP | MF_OWNERDRAW, (UINT)menuItem->GetSubMenu(), menuItem->itemLabel);


When the MF_OWNERDRAW flag is set for a popup menu, all the members of the LPDRAWITEMSTRUCT seem to go haywire. All other menu items work fine. If I remove the MF_OWNERDRAW flag, all the submenus works perfectly. The sad thing is, I am still needing to use the itemID member of the LPDRAWITEMSTRUCT to determine which menu item is being drawn!

Am I missing something in my initialization? Or, is there another way to determine the ID of the menu item being drawn other than lpdis->itemID?

Thanks! Almost there...

[Edit]

Apparantly AppendMenu and SetMenuInfo doesn't quite it for initializing the LPDRAWITEMSTRUCT. Using InsertMenuItem did the trick.

modified on Wednesday, June 18, 2008 7:45 PM

QuestionMoving desktop shortcuts to desired position Pin
Manfred Staiger16-Jun-08 5:13
Manfred Staiger16-Jun-08 5:13 
QuestionCRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 5:13
Vaclav_16-Jun-08 5:13 
AnswerRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Chris Losinger16-Jun-08 6:54
professionalChris Losinger16-Jun-08 6:54 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 7:13
Vaclav_16-Jun-08 7:13 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 7:16
Vaclav_16-Jun-08 7:16 
AnswerRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Stephen Hewitt16-Jun-08 15:44
Stephen Hewitt16-Jun-08 15:44 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 17:28
Vaclav_16-Jun-08 17:28 
QuestionCreating an embeded window in Internet Explorer Pin
chatko16-Jun-08 2:30
chatko16-Jun-08 2:30 
AnswerRe: Creating an embeded window in Internet Explorer Pin
ThatsAlok16-Jun-08 3:22
ThatsAlok16-Jun-08 3:22 
QuestionProblem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 2:26
ritz123416-Jun-08 2:26 
AnswerRe: Problem with a program that does Copy-Paste functionality. Pin
CPallini16-Jun-08 2:40
mveCPallini16-Jun-08 2:40 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 2:57
ritz123416-Jun-08 2:57 
AnswerRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 3:30
David Crow16-Jun-08 3:30 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 3:43
ritz123416-Jun-08 3:43 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 3:50
David Crow16-Jun-08 3:50 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 4:00
ritz123416-Jun-08 4:00 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 6:07
David Crow16-Jun-08 6:07 

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.