mrsirbossman
Sun Oct 22 23:48:02 CDT 2006
> "mr.sir bossman" <mrsirbossman@discussions.microsoft.com> wrote in
> message news:C06ABCF1-A5BB-4B64-9D2E-D7AA311010D6@microsoft.com
> > "John Carson" wrote:
> >> "mr.sir bossman" <mrsirbossman@discussions.microsoft.com> wrote in
> >> message news:A578A48B-C986-4C32-A31C-3D193D9E4325@microsoft.com
> >>> "John Carson" wrote:
> >>>>> How do you hi-light a menu(TrackPopupMenuEx) item?
> >>>>>
> >>>>> Note: HiliteMenuItem(...) works...sortof. It hi-lights the item
> >>>>> but then when you use the arrow keys you see two hilights(yours
> >>>>> and the real one).
> >>>>
> >>>> It is not clear why you want to do this.
> >>>
> >>> IE style Menubar. When the user presses Alt and then the down arrow
> >>> I want the first item to be selected.
> >>
> >> Have you seen this?
> >>
> >>
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/faq/iemenubar.asp?frame=true
> > Sadly it is a generalization and offers no solution to my problem.
>
> There may be more elegant ways, but to select the first item in a popup
> menu, you can do the following. Add
>
> PostMessage(hwnd, WM_APP, wParam, 0);
>
> to WM_INITMENUPOPUP processing and then process WM_APP as follows:
>
> RECT rect;
> GetMenuItemRect(0, (HMENU)wParam, 0, &rect);
> SetCursorPos(rect.left+10, rect.top+10);
>
> Note that it doesn't seem to work on XP unless you have a 0 for the HWND as
> the first argument of GetMenuItemRect. Experimentation on other Windows
> versions may be advisable.
I decided to go with
PostMessage(WM_KEYDOWN, VK_DOWN);
in a timer(just before TrackPopupMenuEx). It seems to work.
>
Thx for help.