After reading couple of Articles and MSDN i have learnt that ...
 generally most developer trap WM_MEASUREITEM and  WM_DRAWITEM.

 in WM_MEASUREITEM hnadler , They retrive they iterate through al the
menu ,
 identify the menu they want to owner draw ....and then they modify
the
 menu using ModifyMenu and make the menu item MF_OWNERDRAW and then
they also set MENUINFO ....

 in WM_DRAWITEM handler , they retrive the information they had set
in WM_MEASUREITEM handler
 using the DRAWITEMSTRUCT, which is passed in LPARAM lp.


Now My queries are

1) Is it really necessoy for me to handle WM_MEASUREITEM , and mark a
particular menu
  as MF_OWNERDRAW ... and fill the DRAWITEMSTRUCT struct....

  Can;t I do the same job done while, I am adding these menus..sing
Append Menu...

  FYI: I add these menu lie this ...


       if(wps->message == WM_INITMENUPOPUP)
       {
           HMENU hMenu = (HMENU)wps->wParam;
           if ((IsMenu (hMenu) & (HIWORD(wps->lParam) == TRUE)))
               {
               HMENU hSystemMenu = GetSystemMenu (hWnd, FALSE);
               AppendMenu (hSystemMenu, MF_SEPARATOR, 0,       NULL);
               AppendMenu (hSystemMenu,MF_OWNERDRAW, IDM_PMACTION_K, 
L"&Kill");
               AppendMenu (hSystemMenu,MF_POPUP, (UINT)hMenuPopup, 
L"&Priority");
               }
       }

      Also I remove them back on WM_MENUSELECT msg ...


2)  Do i really need to fill  struct  DRAWITEMSTRUCT  during
AppendMenu ???
   can't i use the 3rd paramter of AppendMenu in  WM_DRAWITEM item
handler ?

   something like this ...

   if  (lparam->itemID  == IDM_PMACTION_K)
   {

      change the Text color and text background color ( only if mouse
is rolled over)

   }

   I tried this but it did not work for me.


3) How to use HDC ??

   have come across lots of MFC apps , which use
   CDC and quite easily handle their functions like
   Fill rectangle, DrawRectangle, settext color, text bck color

   But could not find many examples on WIN32 API for doing the same
   using HDC

4)  I guess the answer of Query 1 is yes, but i am kinda lost on how
to fill the
   DRAWITEMSTRUCT ....
   All i want is I wanna Draw My menu items with custom selected
color and custom font color , when mouse is rolled over them

   Is there any WIN32 example of filling DRAWITEMSTRUCT and then
retreiving it in WM_DRAWITEM  handler..

   Looks like we can pass anyting as the last parameter of AppendMenu
and ModifyMenu.... it need not be
   DRAWITEMSTRUCT

Those who need source code of my application to guide me better cna 
download it from 


http://processpriority.wiki.sourceforge.net/


Reply via email to