VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

MenuAPI Example v1

Danny Krotzer  (2 Submissions)   Windows API Call/Explanation   Visual Basic 5.0   Advanced   Wed 3rd February 2021

This shows how to access another process' menu and clone it in your own application using API. The example allows you to choose an app from a list of open windows, then once the menu is 'cloned', it will allow you to execute menu items in the other process by clicking on them in your own app. This also demonstrates how to create & remove dynamic menus and submenus on your form, as well as handle messages from them when clicked (uses subclassing). API Calls: IsWindow(), SetWindowLong(), EnumWindows(), GetMenuString(), GetMenuItemID(), GetMenuItemCount(), GetMenu(), GetSubMenu(), AppendMenu(), DeleteMenu(), CreatePopupMenu(), DrawMenuBar(), CallWindowProc(), PostMessage(), GetWindowTextLength(), GetWindowText(), & IsWindowVisible()

Side Effects
As with any subclassing and cross-process calls, debugging can be tricky and cause VB Environment to crash so save project often if you make any changes.

Rate MenuAPI Example v1 (5(5 Vote))

Download MenuAPI Example v1

MenuAPI Example v1 Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters