# Visual Basic > Visual Basic 6 and Earlier >  [RESOLVED] API on menues in UserControls

## wwolf

Hello,
I want to apply API functions to a menu in a UserControl to change the menu colors and icons. For forms, I start with the hwnd of the window. About the hwnd of the UserControl I do not get to the menues. How do I have to proceed? W. Wolf

----------


## fafalone

Can you clarify what menu you're trying to modify? Are you trying to modify the host form menu from a UserControl, or a popup menu on a UserControl? You can't have a regular menu bar on a UserControl as it's a child window, unless you were to draw it entirely from scratch yourself.

----------


## dilettante

See the NegotiateMenus Property in the documentation.  This described how you contained controls can have their menus merged onto the menu bar of the containing Form while they have focus.

----------


## Eduardo-

```
UserControl.Parent.hWnd
```

----------


## wwolf

> Can you clarify what menu you're trying to modify? Are you trying to modify the host form menu from a UserControl, or a popup menu on a UserControl?


I create the menus with the VB-Menu-Designer inside the UserControl. So they are popup menus. Menus in the parent would not be a problem. I realize that I don't have a menu bar in the UserControl. 

That's why I need the hwnd of these UserControl menus. I am looking for an API alternative to GetSubMenu. GetSubMenu retrieves a handle to the drop-down menu or submenu activated by the specified menu item. I want to find out the hwnds of the popup menus without going through a menu bar.

----------


## wwolf

> ```
> UserControl.Parent.hWnd
> ```


The hwnd of the menus in the parent are not the problem.

----------


## wwolf

> See the NegotiateMenus Property in the documentation.  This described how you contained controls can have their menus merged onto the menu bar of the containing Form while they have focus.


I am aware of that. But with this I still don't get the hwnd of the UserControl menus. As I said, I want to color and bitmap these menus when the control is loaded. I can of course create the menus right in the parent window, but in doing so I lose the code encapsulation. This is not bad but not very nice.

----------


## dilettante

Sorry, I was responding to post #2 above.

----------


## fafalone

I don't think there is a hwnd until the menu pops up. You can intercept that, but honestly you're better off using CreatePopupMenu and TrackPopupMenu etc to roll your own.

----------


## wwolf

> I don't think there is a hwnd until the menu pops up.


You're probably right. Then I guess I will have to place the menus in the form. Creating the complete menu myself and monitoring it with subclassing is too much work for me in my small application.

----------

