
Signature
Mike
Microsoft MVP Visual Basic
Well, think about this...
I am creating a replacement for a sub menu that I want to fall under the top
menu that I click, therefore I need to know where the top menu is so I can
properly place it. I can create this menu without using any API call or
subclassing, but how to I locate it? Seems that Y=0 under the menu on the
form, but what about X?
Bottom line, I am creating a menu that shows font names and also shows a
sample of the font dynamically (per user sample text). All is working except
nice programmable X placement.
So how do I get the coordinates?
> > VB6
> > How do I get the mouse click x, y when a top menu or submenu is clicked?
[quoted text clipped - 4 lines]
> clicked. I, for one, can't think of a reason why you'd need the actual
> mousepointer coordinates.
Jeff Johnson - 29 Jul 2008 18:27 GMT
> Well, think about this...
> I am creating a replacement for a sub menu that I want to fall under the
[quoted text clipped - 10 lines]
>
> So how do I get the coordinates?
Seriously: scrap that whole idea and look into the concept of owner-drawn
menus. Yes, it requires using API functions. Yes, they're very C-like and
not very intuitive to use for a die-hard VBer. But there should be some
existing code out there that you can steal huge chunks of (if not all).
Lorin - 29 Jul 2008 21:19 GMT
I previously look.
None had mixed font capability.
mine does.
> > Well, think about this...
> > I am creating a replacement for a sub menu that I want to fall under the
[quoted text clipped - 15 lines]
> not very intuitive to use for a die-hard VBer. But there should be some
> existing code out there that you can steal huge chunks of (if not all).
Jeff Johnson - 29 Jul 2008 21:54 GMT
>I previously look.
> None had mixed font capability.
> mine does.
Well, if you're willing to combine the code from two projects, look at
http://vbaccelerator.com/home/VB/Code/Controls/Combo_and_List_Boxes/Owner_Draw_C
ombo_and_List_Box/article.asp
and
http://vbaccelerator.com/home/VB/Code/Controls/Menus/PopupMenu_-_OwnerDraw_Menu_
Items/article.asp
Lorin - 30 Jul 2008 00:12 GMT
Thanks, but I'll stick with my superior implementation. It is more robust
and simpler and easier to understand. It is all rolled in to one .bas
I found how to get access to global mouse operation and then find the mouse
location on the form when the menu is clicked. There are several methods.
So I will try the simpler one first.
> >I previously look.
> > None had mixed font capability.
[quoted text clipped - 7 lines]
>
> http://vbaccelerator.com/home/VB/Code/Controls/Menus/PopupMenu_-_OwnerDraw_Menu_
Items/article.asp
expvb - 30 Jul 2008 04:45 GMT
Maybe GetCursorPos() is what you want? It gives pixel coordinates of the
mouse pointer whenever you call it. Also check ScreenToClient/ClientToScreen
to convert from screen coordinates to a position relative to the upper left
corner of the client area inside the form.