I'm a school guy from Sri Lanka.Still im not following any course.I'm very interesting in doing programming with VB6 and using some books referenced VB6 .I'm a apprentice.
My question is

* How to disable the Close Button?
*Can we have links with external softweres like WinZip etc through VB6?If there is a passcode to be entered,Is that possible to do through VB6 application?What is the code has to be use?

Thanks.
Randika

Recommended Answers

All 3 Replies

try to use this

Option Explicit

Private Declare Function GetSystemMenu Lib "user32" _
    (ByVal hwnd As Long, _
     ByVal bRevert 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 Const MF_BYPOSITION = &H400&

Public Function DisableCloseButton(frm As Form) As Boolean

'PURPOSE: Removes X button from a form
'EXAMPLE: DisableCloseButton Me
'RETURNS: True if successful, false otherwise
'NOTES:   Also removes Exit Item from
'         Control Box Menu


    Dim lHndSysMenu As Long
    Dim lAns1 As Long, lAns2 As Long
    
    
    lHndSysMenu = GetSystemMenu(frm.hwnd, 0)

    'remove close button
    lAns1 = RemoveMenu(lHndSysMenu, 6, MF_BYPOSITION)

   'Remove seperator bar
    lAns2 = RemoveMenu(lHndSysMenu, 5, MF_BYPOSITION)
    
    'Return True if both calls were successful
    DisableCloseButton = (lAns1 <> 0 And lAns2 <> 0)

End Function

Hi,

Just Set form's
ControlBox = False
BorderStyle = 1
the corner "X" will be removed...

Regards
Veena

hei veena

randhika needs to disable the x button not to remove

and she needs to use the maximize and minimize buttons

if we do as u said we will loss the max min butons

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.