PDA

Click to See Complete Forum and Search --> : API Menus in Other Apps and Callback..Help!!


Nice
Oct 20th, 2000, 05:33 AM
Hello,

Can anyone tell me how to add menus in other Apps thru'API Calls and implement callback function in VB Code..Please Help...

Nice

Vlatko
Oct 20th, 2000, 07:34 AM
You can use this to add a menu to any window just change the hwndofwindow.It will add a menu called "some text"(you can change it of course)

Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Public Const MF_BYCOMMAND = &H0&
Public Const MF_BYPOSITION = &H400&

Dim mmen As Long
Dim submen As Long
mmen = GetMenu(hwndofwindow)
submen = GetSubMenu(mmen, 0)
AppendMenu submen, MF_BYCOMMAND, 1, "Some Text"


You can not react when the user clicks the menu on the other app because you will need to subclass thw window and subclassing other windows is not possible in VB without a C++ dll.