Results 1 to 24 of 24

Thread: To disable minimize and close button in VB6

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    94

    Angry To disable minimize and close button in VB6

    I have created one form in VB which after validating proper user id and password allows internet access to the user. So if user is authorised to log in, form creates object of IE. But I've hide taskbar and also have disabled alt+tab key. so I want to keep atleast one window of IT to be open. So for that I want to disable minimize key and close button. So plz help me.

    Thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: To disable minimize and close button in VB6

    Do you want to do this to IE or your VB form?

  3. #3
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: To disable minimize and close button in VB6

    Take the border off the form

    Property is "Borderstyle" to 0

    You can use an api to always keep a check on if the program is lost. Remember Alt+F4 can close a program
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    94

    Re: To disable minimize and close button in VB6

    IE object doesn't have Border style property. My screen has only two windows, one is my form using which i've created IE object and my form which shows time left for log out. But if IE window gets closed before logout time, there is no other way to open new IE window as i've made all windows disable. but i don't want user to minimize IE window which I've created using program.

  5. #5
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: To disable minimize and close button in VB6

    hack i don't know about 'damini' but i sure want to know how to do that to your vb form

    you know some of these questions never crossed your mind until somebody else asks
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  6. #6
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: To disable minimize and close button in VB6

    Why not embed an IE control into a form of yours and control it directly
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    94

    Re: To disable minimize and close button in VB6

    I want to do that in VB form

  8. #8
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: To disable minimize and close button in VB6

    that's what Bodwad just said. Put the browser control on the form, and size it the same as the form. Then set the form's BorderStyle property to 0-No borders. That will prevent people from closing the form.

  9. #9
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: To disable minimize and close button in VB6

    To Clarify more (just in case):

    Right CLick your toolbar add components > Microsoft Internet Control

    now draw the new control on your form.. it is IE so it will act the same
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  10. #10
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 2002
    Location
    Nottingham
    Posts
    2,176

    Re: To disable minimize and close button in VB6

    Sorry I should have elaborated. Be warned though, always distribute you application completely. We found the ActiveX for IE changed unexpectadly and caused trouble on old machines unless it was included in the root path of the application
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  11. #11
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: To disable minimize and close button in VB6

    Here's any easy way to do it.

    Set the ControlBox property to 'False,' but that will also get rid of the Minimize and Maximize buttons. This works great if all you're doing is prompting the user with a popup form to enter supplemental information that gets used as input on an underlying form (like you might do with field level input validation) and you want to control how the user enters and exits the popup.

    Your exit strategy is to have "Okay" and "Cancel" command buttons on the form. The user can then enter the requested data or not. But you control how they exit the form.

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: To disable minimize and close button in VB6

    vb6coder14, almost exactly 9 years late on the reply
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by LaVolpe View Post
    vb6coder14, almost exactly 9 years late on the reply
    That's very funny, really! If I was coding VB6 nine years ago I would have been happy to help. But I ran into this problem just today and searched the Internet for a solution since I couldn't find one here (unless I missed it).

    I searched this forum high and low for a simple solution that didn't rely on large blocks of code, Windows APIs, or DLLs. As operating systems change, those solutions tend to break and are difficult to fix. Not finding an acceptable solution here, I turned to the Internet and searched until I found something that fit my style and programming philosophy.

    I thought it was important to share a more modern approach to this old problem. Therefore, I decided to post my implementation on this forum for the benefit of other newbies like myself, as rare as we may be at this point in time.
    Last edited by vb6coder14; Oct 29th, 2014 at 02:06 PM. Reason: To explain why I'm updating this very old post!

  14. #14
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: To disable minimize and close button in VB6

    If we're talking about a VB6 form, I almost always try to do this with the BorderStyle, MinButton, MaxButton, and ControlBox properties. Things just work out cleaner that way. However, it can be done with API calls during runtime. The Min and Max buttons won't be removed, but they will be disabled.

    Here's a little app with a Class that shows you a pretty nice way to get it done with API calls. (To Navion, just more "stuff" out of that junk drawer.)

    xForms.zip

    EDIT: Took unused DLL reference out of the VBP project.

    I've got another version that subclasses the form and is able to control it much more, but I'll wait on someone to ask for one of the functions it has before posting it.
    Last edited by Elroy; Oct 30th, 2014 at 03:04 PM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  15. #15
    gibra
    Guest

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by Elroy View Post
    If we're talking about a VB6 form, I almost always try to do this with the BorderStyle, MinButton, MaxButton, and ControlBox properties. Things just work out cleaner that way. However, it can be done with API calls during runtime. The Min and Max buttons won't be removed, but they will be disabled.

    Here's a little app with a Class that shows you a pretty nice way to get it done with API calls. (To Navion, just more "stuff" out of that junk drawer.)

    Attachment 120241

    I've got another version that subclasses the form and is able to control it much more, but I'll wait on someone to ask for one of the functions it has before posting it.
    DLL is missing.

  16. #16
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    557

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by Elroy View Post
    (To Navion, just more "stuff" out of that junk drawer.)

    Hummmm you say ???

    I'll check this up.

  17. #17
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: To disable minimize and close button in VB6

    gibra,

    I'm not sure what you mean. Are you saying that you try and run the little project I gave you and you're getting a DLL missing error? If that's the cases, you've got some serious problems. The only DLL I use is user32.dll, and that's a VERY core part of the Windows Operating System. (There is a reference to kernel32.dll, but it's never called, and that's also a VERY core part of Windows.)

    Maybe you thought I was going to include a DLL with my project. No no, not at all. This is the source code to show you how to do what the thread starter requested, "To disable minimize and close button in VB6". No DLL necessary. In fact, it's against VBForums' policy to attach compiled code.

    I hope this helps,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  18. #18
    gibra
    Guest

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by Elroy View Post
    gibra,

    I'm not sure what you mean. Are you saying that you try and run the little project I gave you and you're getting a DLL missing error?
    Yes.

    Quote Originally Posted by Elroy View Post
    If that's the cases, you've got some serious problems.
    Sorry for you: I'm not problem, YOUR project has problem:

    Code:
    Reference=*\G{F3781BA0-FAAA-11D1-8B3E-DCAA556D18B8}#1.0#0#..\..\..\..\VB Etc\VB, Database, & HTML Projects2\xForms\gwsubcls.dll#gwSubcls subclassing component
    Check your zip, please.

  19. #19
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: To disable minimize and close button in VB6

    Ahhh, so sorry. That's a reference that shouldn't be in there. It's not used. You can just edit the VBP file and delete that line, but I'll repost.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  20. #20
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: To disable minimize and close button in VB6

    Again, sorry about that. It's all fixed up now. Just go back to post #14 and re-download it. It's all totally standard (no subclassing) VB6 stuff now.

    Enjoy
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  21. #21
    Hyperactive Member
    Join Date
    Oct 2014
    Posts
    261

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by Elroy View Post
    If we're talking about a VB6 form, I almost always try to do this with the BorderStyle, MinButton, MaxButton, and ControlBox properties. Things just work out cleaner that way.
    I'm totally with you there. It's cleaner and more reliable in the long term. No moving parts to track and/or maintain.

  22. #22
    Junior Member
    Join Date
    Jun 2021
    Location
    Germany
    Posts
    17

    Re: To disable minimize and close button in VB6

    Quote Originally Posted by Elroy View Post
    If we're talking about a VB6 form, I almost always try to do this with the BorderStyle, MinButton, MaxButton, and ControlBox properties. Things just work out cleaner that way. However, it can be done with API calls during runtime. The Min and Max buttons won't be removed, but they will be disabled.

    Here's a little app with a Class that shows you a pretty nice way to get it done with API calls. (To Navion, just more "stuff" out of that junk drawer.)

    xForms.zip

    EDIT: Took unused DLL reference out of the VBP project.

    I've got another version that subclasses the form and is able to control it much more, but I'll wait on someone to ask for one of the functions it has before posting it.
    Where do I get the gwsubcls.dll?

    Seems to be required for this to work:
    Private WithEvents subfrm As SubCls

  23. #23
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: To disable minimize and close button in VB6

    ???? Did you download and run Elroy's project? No need for any DLL. Where do you see: "Private WithEvents subfrm As SubCLs"?
    Sam I am (as well as Confused at times).

  24. #24
    Junior Member
    Join Date
    Jun 2021
    Location
    Germany
    Posts
    17

    Re: To disable minimize and close button in VB6

    I must have downloaded an older copy.
    I removed the "Private WithEvents subfrm As SubCLs" and reference and now it works.
    Thank you!

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