Results 1 to 2 of 2

Thread: API Menus in Other Apps and Callback..Help!!

  1. #1

    Thread Starter
    Addicted Member Nice's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    144

    Angry

    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

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    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)
    Code:
    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.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width