|
-
Apr 24th, 2000, 02:29 AM
#1
How can I disable the X on in Word 9.0(Near the maximize and Minimize buttons). I would also like to know how to disable the close option on the right-click Popup menu. Any help will be appretiated. Thanks in advance.
John
-
Apr 24th, 2000, 11:27 AM
#2
Lively Member
Hiya,
Well there's no direct route for a Node to tell you what TYPE it is. What u could do is ask it who its Parent is? If on exists you get the associated key. If not, well then its a Root. Thats about all i can think of....
Cheers
Gaurav
[email protected]
" Programming today is a race between software-engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
So far the universe is winning". :-)
-
Apr 24th, 2000, 11:00 PM
#3
Hyperactive Member
John, this works for Word97 (should work fine for Word 2000):
Code:
Option Explicit
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Sub Form_Load()
Dim hSysMenu As Long
Dim nCnt As Long
Dim lhwnd As Long
'Get Handle to MS Word
lhwnd = FindWindow(vbNullString, "Microsoft Word - Document1")
'Get Handle to its System Menu
hSysMenu = GetSystemMenu(lhwnd, False)
If hSysMenu Then
'Get System menu's menu count
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
'Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, _
MF_BYPOSITION Or MF_REMOVE
'Remove the Separator
RemoveMenu hSysMenu, nCnt - 2, _
MF_BYPOSITION Or MF_REMOVE
'Force caption bar's refresh. Disabling X button
DrawMenuBar Me.hwnd
End If
End If
End Sub
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
|