Results 1 to 13 of 13

Thread: Append a Form's System Menu

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question

    Hi,
    How can I append a Form's System Menu and And also detect when it has been clicked?
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Guest
    What do you man by append to the form's system menu? You mean like add menu to the Restore, Maximize, Minimize, Close etc.?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Exclamation Yes, That is exactly what I'm talking about

    Yes Megatron,
    That is exactly what I'm talking about. The menu that appears when you click onthe top left hand corner of a form.
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  4. #4
    Guest
    Hmmm, I think that's a default set by Windows, but there might be a way around it. I'll try testing some things out and get back to you in a couple of days.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Lightbulb I think it has something to do with the AppendMenu API

    I think it has something to do with the AppendMenu API
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Talking I found It

    Hi everyone,
    I found a perfect example.
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  7. #7
    Guest
    Yes, that does look like the solution. I think you can also add to normal menus using that API.



  8. #8
    Guest
    Wait a sec. The InsertMenuItem API adds a menu item to a menu that already exsists. This is probably what you're looking for.


  9. #9
    New Member
    Join Date
    May 2000
    Posts
    13

    Question Excuse me,where's the sample?

    Hi,where's the sample?Can you let me have a look?

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Exclamation I don't know your email address Netfox

    I don't know your email address Netfox
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  11. #11

  12. #12
    Guest

    Try this. Make a Form with a CommandButton and put this code in the Declarations section of the Form.

    Code:
    Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
    Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
    Private Declare Function SetMenu Lib "user32" (ByVal hwnd As Long, ByVal hMenu As Long) As Long
    Const MF_STRING = &H0&
        
    
    Private Sub Command1_Click()
        
        Dim mnuMenu As Long, mnuMenuI As Long
        
        mnuMenu = GetSystemMenu(Me.hwnd, 0)
        mnuMenuI = GetMenuItemID(mnuMenu, 0)
        ModifyMenu mnuMenu, mnuMenuI, MF_STRING, mnuMenuI, "Restore my Bollocks"
        mnuMenuI = GetMenuItemID(mnuMenu, 1)
        ModifyMenu mnuMenu, mnuMenuI, MF_STRING, mnuMenuI, "Move u'r fat arse!"
        mnuMenuI = GetMenuItemID(mnuMenu, 6)
        ModifyMenu mnuMenu, mnuMenuI, MF_STRING, mnuMenuI, "Bugger off!"
    
    End Sub

  13. #13
    Guest
    Just placing this at thre top incase you missed it.

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