Results 1 to 5 of 5

Thread: Vb6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    208

    Vb6

    Hi,
    I hava a form in which I have given the user the
    TERMINATE button.
    I dont want the user to click on the (CLOSE WINDOW) button
    of the form ( on the top right corner) .

    Can I defuse that close sign which is next to the
    minimize and maximize button with the help pf form
    properties.


    thnks

  2. #2

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    This will disable the Close button.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
    4.                                                      ByVal bRevert As Long) _
    5.                                                      As Long
    6. Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
    7.                                                   ByVal nPosition As Long, _
    8.                                                   ByVal wFlags As Long) _
    9.                                                   As Long
    10.                                                  
    11. Private Const SC_CLOSE = &HF060&
    12. Private Const MF_BYCOMMAND = &H0&
    13.  
    14. Private Sub Form_Load()
    15. Dim hMnu As Long
    16.  
    17.     hMnu = GetSystemMenu(Me.hwnd, False)
    18.     Call RemoveMenu(hMnu, SC_CLOSE, MF_BYCOMMAND)
    19.  
    20. End Sub

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by MartinLiss
    This question has been asked and answered many times. Please use the forum Search and you'll find the answer. You should also click the How to Get Your Questions Answered link in my signature.
    Yeah, that too.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Lively Member Cagez's Avatar
    Join Date
    Oct 2002
    Posts
    121
    If you don't need the icon, min, max or close buttons showing, just put ControlBox to False in your form properties... I always use it

    Edit: Err, right?
    Last edited by Cagez; Dec 2nd, 2002 at 08:33 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width