Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCREATING AND USING HANDLE??? Pin
chapelle1-May-04 12:37
chapelle1-May-04 12:37 
AnswerRe: CREATING AND USING HANDLE??? Pin
Hauptman(n)1-May-04 22:08
Hauptman(n)1-May-04 22:08 
GeneralRe: Averaging Calculation Pin
Terry O'Nolley1-May-04 14:08
Terry O'Nolley1-May-04 14:08 
GeneralDll inside .EXE Pin
Opwar1-May-04 11:30
Opwar1-May-04 11:30 
GeneralResizing into a CListCtrl Pin
Rafael Fernández López1-May-04 11:15
Rafael Fernández López1-May-04 11:15 
GeneralDeleting System Restore points/files Pin
Monk_1-May-04 11:15
Monk_1-May-04 11:15 
QuestionHow to open Crystal Report file Pin
crazymubashir1-May-04 11:06
crazymubashir1-May-04 11:06 
GeneralCMenu ownerdraw Pin
pie1-May-04 10:41
pie1-May-04 10:41 
Hello.

I would like to create an owner-drawn CMenu class, and therefore i override DrawItem and MeasureItem, like this:
<br />
class MyMenu : public CMenu {<br />
	public:<br />
		virtual void DrawItem(LPDRAWITEMSTRUCT lpDis);<br />
		virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMis);<br />
	};<br />
<br />
void MyMenu::DrawItem(LPDRAWITEMSTRUCT lpDis)<br />
{<br />
}<br />
void MyMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMis)<br />
{<br />
}<br />


And then I add a menu to my app's CMainFrame:
<br />
//MainFrm.h<br />
MyMenu TopMenu;<br />
<br />
//Mainfrm.cpp<br />
TopMenu.LoadMenu(IDR_MAINFRAME);<br />
	for(int i = 0; i<3; ++i)<br />
		TopMenu.ModifyMenu(ID_DAWS_HEJ+i, MF_OWNERDRAW, ID_DAWS_HEJ+i);<br />
	SetMenu(&TopMenu);<br />


But the problem is that DrawItem and MeasureItem are never called! I do receive WM_DRAWITEM and WM_MEASUREITEM, but they are just not handled by my class. What do I do?
GeneralAccelerators Pin
michou1-May-04 10:20
michou1-May-04 10:20 
Generalva_list and COleVariant Pin
brdavid1-May-04 9:48
brdavid1-May-04 9:48 
GeneralRe: va_list and COleVariant Pin
Michael Dunn1-May-04 9:58
sitebuilderMichael Dunn1-May-04 9:58 
GeneralParameter Problem Pin
soul.ripper1-May-04 9:15
soul.ripper1-May-04 9:15 
GeneralRe: Parameter Problem Pin
Michael Dunn1-May-04 10:02
sitebuilderMichael Dunn1-May-04 10:02 
Generalsleep( ) Pin
Anonymous1-May-04 7:42
Anonymous1-May-04 7:42 
GeneralRe: sleep( ) Pin
soul.ripper1-May-04 8:59
soul.ripper1-May-04 8:59 
GeneralRe: sleep( ) Pin
Anonymous1-May-04 9:08
Anonymous1-May-04 9:08 
GeneralRe: sleep( ) Pin
Paul Ranson2-May-04 10:48
Paul Ranson2-May-04 10:48 
GeneralUsing .Net components in a MFC application Pin
Jaran Nilsen1-May-04 7:33
Jaran Nilsen1-May-04 7:33 
Generalpow(-1, 0.3333333333) doesn't return -1 Pin
Roman Nurik1-May-04 6:58
Roman Nurik1-May-04 6:58 
GeneralRe: pow(-1, 0.3333333333) doesn't return -1 Pin
Michael Dunn1-May-04 10:13
sitebuilderMichael Dunn1-May-04 10:13 
GeneralRe: pow(-1, 0.3333333333) doesn't return -1 Pin
Roman Nurik1-May-04 14:01
Roman Nurik1-May-04 14:01 
Generaland it shouldn't Pin
Tim Smith1-May-04 14:17
Tim Smith1-May-04 14:17 
GeneralRe: and it shouldn't Pin
Roman Nurik1-May-04 14:38
Roman Nurik1-May-04 14:38 
GeneralRe: and it shouldn't Pin
Tim Smith1-May-04 15:51
Tim Smith1-May-04 15:51 
GeneralRe: and it shouldn't Pin
Barvus1-May-04 19:49
Barvus1-May-04 19:49 

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.