removing the X in the corner of the document

removing the X in the corner of the document

Anonymous
Not applicable
252 Views
2 Replies
Message 1 of 3

removing the X in the corner of the document

Anonymous
Not applicable
I am working on a VB6 project and need to remove the X terminate button in the upper right corner of the document.
I was wondering if anyone knows the API call that might help remove that.

Thanks
Dan
0 Likes
253 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable


style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial color=#000000>'Declare


style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial color=#000000>Declare Function DrawMenuBar Lib "User32" (ByVal hWnd
As _
Long) As Long
Declare Function GetMenuItemCount Lib "User32" (ByVal
hMenu _
As Long) As Long
Declare Function GetSystemMenu Lib "User32"
(ByVal hWnd As _
Long, ByVal bRevert As Long) As Long
Declare Function
RemoveMenu Lib "User32" (ByVal hMenu As Long, _
ByVal nPosition As Long,
ByVal wFlags As Long) As Long

style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">


face=Arial>Public Const MF_BYPOSITION = &H400
Public Const MF_REMOVE =
&H1000

 

'Form Code

 

Private Sub
Form_Load()
Dim hMenu As Long
Dim lItemCount As
Long

hMenu = GetSystemMenu(Me.hWnd, 0)



style="FONT-FAMILY: 'Trebuchet MS'">If hMenu
Then



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
lItemCount =
GetMenuItemCount(hMenu)



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
Call RemoveMenu(hMenu, lItemCount
- 1, MF_REMOVE Or _



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
MF_BYPOSITION)

style="mso-spacerun: yes">  
Call RemoveMenu(hMenu, lItemCount
- 2, MF_REMOVE Or _



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
MF_BYPOSITION)



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
Call
DrawMenuBar(Me.hWnd)



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial>End If
End Sub


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
 


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">HTH


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
--

Veign
Designing Solutions

href="http://www.veign.com">www.veign.com

VB Code Samples &
Projects

href="http://www.veign.com/information/info_main.html">www.veign.com/information/info_main.html



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">I
am working on a VB6 project and need to remove the X terminate button in the
upper right corner of the document.
I was wondering if anyone knows the
API call that might help remove that.

Thanks
Dan

0 Likes
Message 3 of 3

Anonymous
Not applicable
If anyone is interested, to do this in AutoCAD's
VBA you have to change it
to this:

 

'Declare

 

Public Declare Function FindWindow Lib "user32"
Alias "FindWindowA" _     <-
Insert
(ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
<-
Insert
Public Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd As
Long) As Long
Public Declare Function GetMenuItemCount Lib "user32"
_
(ByVal hMenu As Long) As Long
Public Declare Function GetSystemMenu Lib
"user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public
Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal
nPosition As Long, ByVal wFlags As Long) As Long

 

Public Const MF_BYPOSITION = &H400
Public
Const MF_REMOVE = &H1000
Public Const MF_BYPOSITION = &H400
Public
Const MF_REMOVE = &H1000

 

'Form Code

 

Private Sub
UserForm_Initialize()
    Dim hwnd As
Long                                           
<- Insert
    Dim hMenu As Long
    Dim
lItemCount As Long

 

    hwnd = FindWindow(vbNullString,
Me.Caption)    <- Insert

 

    hMenu = GetSystemMenu(hwnd,
0)                  
<- Change

 

    If hMenu Then

 

       lItemCount =
GetMenuItemCount(hMenu)

 

       Call
RemoveMenu(hMenu, lItemCount - 1, MF_REMOVE Or
MF_BYPOSITION)
       Call RemoveMenu(hMenu,
lItemCount - 2, MF_REMOVE Or MF_BYPOSITION)

 

       Call
DrawMenuBar(hwnd)                               
<- Change

 

    End If
End Sub

 


Cya,
Chad.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">



style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial color=#000000>'Declare


style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial color=#000000>Declare Function DrawMenuBar Lib "User32" (ByVal hWnd
As _
Long) As Long
Declare Function GetMenuItemCount Lib "User32" (ByVal
hMenu _
As Long) As Long
Declare Function GetSystemMenu Lib "User32"
(ByVal hWnd As _
Long, ByVal bRevert As Long) As Long
Declare Function
RemoveMenu Lib "User32" (ByVal hMenu As Long, _
ByVal nPosition As Long,
ByVal wFlags As Long) As Long

style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">


face=Arial>Public Const MF_BYPOSITION = &H400
Public Const MF_REMOVE =
&H1000

 

'Form Code

 

Private Sub
Form_Load()
Dim hMenu As Long
Dim lItemCount As
Long

hMenu = GetSystemMenu(Me.hWnd, 0)



style="FONT-FAMILY: 'Trebuchet MS'">If hMenu
Then



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
lItemCount =
GetMenuItemCount(hMenu)



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
Call RemoveMenu(hMenu,
lItemCount - 1, MF_REMOVE Or _



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
MF_BYPOSITION)

style="mso-spacerun: yes">  
Call RemoveMenu(hMenu,
lItemCount - 2, MF_REMOVE Or _



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
MF_BYPOSITION)



style="FONT-FAMILY: 'Trebuchet MS'">
style="mso-spacerun: yes">  
Call
DrawMenuBar(Me.hWnd)



style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
face=Arial>End If
End Sub


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
 


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">HTH


style="FONT-SIZE: 10pt; FONT-FAMILY: 'Trebuchet MS'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
--

Veign
Designing Solutions

href="http://www.veign.com">www.veign.com

VB Code Samples &
Projects

href="http://www.veign.com/information/info_main.html">www.veign.com/information/info_main.html



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">I
am working on a VB6 project and need to remove the X terminate button in the
upper right corner of the document.
I was wondering if anyone knows the
API call that might help remove that.

Thanks
Dan

0 Likes