VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Change the system menu 4 ur form

by MangaMorgan (3 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

Changes your forms system menu (visible when you right click on the forms titlebar or press [Alt] + [Space]) to what every you want, and does it really easily too!

Rate Change the system menu 4 ur form

'~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~
' place a button on the form called "command1" and test
' run this project. Notice how BEFORE you click the button
' the forms system menu (press [Alt] + [Space]) is the
' normal on. Now press the button! It has changed! :)
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
' ^ APIs required 4 menu change!
Const MF_STRING = &H0&
' ^ CONSTANTs required 4 menu change!
Private Sub command1_click()
 Dim hMenu As Long, MenuItem As Long
 
 hMenu = GetSystemMenu(Me.hwnd, 0)
 
 MenuItem = GetMenuItemID(hMenu, 0)
 ModifyMenu hMenu, MenuItem, MF_STRING, MenuItem, "Restore my Bollocks"
 
 MenuItem = GetMenuItemID(hMenu, 1)
 ModifyMenu hMenu, MenuItem, MF_STRING, MenuItem, "Move u'r fat arse!"
  
 MenuItem = GetMenuItemID(hMenu, 6)
 ModifyMenu hMenu, MenuItem, MF_STRING, MenuItem, "Bugger off!"
End Sub

Download this snippet    Add to My Saved Code

Change the system menu 4 ur form Comments

No comments have been posted about Change the system menu 4 ur form. Why not be the first to post a comment about Change the system menu 4 ur form.

Post your comment

Subject:
Message:
0/1000 characters