|
-
June 13th, 2001, 03:23 PM
#1
How to hide the system menu??/
Given a Handle to a window, how do i turn off the System Menu.. (for eg., to hide the Max, Min, Move, close buttons)???
-
June 13th, 2001, 04:06 PM
#2
Re: How to hide the system menu??/
I've seen this at www.VB-helper
Go to the HOW TO section and use search. You should find a neat little beast
I'll have a look for it in the mean time
Phil
-
June 13th, 2001, 04:10 PM
#3
Re: How to hide the system menu??/
Special thanks to Rod Stevens and Vb helper for this code
Option Explicit
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub RemoveMenus(frm As Form, _
remove_restore As Boolean, _
remove_move As Boolean, _
remove_size As Boolean, _
remove_minimize As Boolean, _
remove_maximize As Boolean, _
remove_seperator As Boolean, _
remove_close As Boolean)
Dim hMenu As Long
' Get the form's system menu handle.
hMenu = GetSystemMenu(hwnd, False)
If remove_close Then DeleteMenu hMenu, 6, MF_BYPOSITION
If remove_seperator Then DeleteMenu hMenu, 5, MF_BYPOSITION
If remove_maximize Then DeleteMenu hMenu, 4, MF_BYPOSITION
If remove_minimize Then DeleteMenu hMenu, 3, MF_BYPOSITION
If remove_size Then DeleteMenu hMenu, 2, MF_BYPOSITION
If remove_move Then DeleteMenu hMenu, 1, MF_BYPOSITION
If remove_restore Then DeleteMenu hMenu, 0, MF_BYPOSITION
End Sub
Private Sub Form_Load()
RemoveMenus Me, False, False, _
False, True, True, _
False, False
End Sub
Phil
-
June 13th, 2001, 04:57 PM
#4
Re: How to hide the system menu??/
Phil,
I tried looking up the website u mentioned, there doesn't seem to be a search engine???
-
June 13th, 2001, 06:38 PM
#5
Re: How to hide the system menu??/
There is a search eng there and I used it. Se my mail above as I went there, used the eng and found the program. It's posted on the other mail.
I do agree that the search eng is not easy to find but press HOW TO and look on the right hand side of the screen - it is there
good luck
Phil
-
June 14th, 2001, 07:30 AM
#6
Re: How to hide the system menu??/
Try the following:
Put in a mnodule or Private these in the general declations of a form.
public Declare Function GetSystemMenu Lib "user32" (byval hwnd as Long, byval bRevert as Long) as Long
public Declare Function DeleteMenu Lib "user32" (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long) as Long
public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, lParam as Long) as Long
public Const SC_CLOSE = &HF060
public Const SC_MOVE = &HF010
public Const SC_SIZE = &HF000
public Const MF_BYCOMMAND = &H0&
public Const WM_NCACTIVATE = &H86
public Const SC_MINIMIZE = &HF020&
public Const SC_MAXIMIZE = &HF030&
Put the following in the form load event:
Dim hMenu as Long, Success as Long
hMenu = GetSystemMenu(me.hwnd, 0)
Success = DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND)
Success = DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
SendMessage me.hwnd, WM_NCACTIVATE, 0&, 0&
SendMessage me.hwnd, WM_NCACTIVATE, 1&, 0&
This will disable the menu's.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|