Tools Links Login

Change the system menu 4 ur form!

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!

Original Author: MangaMorgan

Code

'~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~
' 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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 106 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.