Results 1 to 11 of 11

Thread: how to make my caprion bar's close button be invisible

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    how to make my caprion bar's close button be invisible

    Hi all,
    this thread is regarding to v.b 6.0. we know that the caption bar of every form also contains three buttons.those are minimize, close, and restore. now i want to remove those things. snce, as my v.b application is having close button( i already set the forms boarder style as 1:fixed single),my user is trying to close the application. but my user should not do like that...
    what can i do to achieve this... if u know that kindly let me know this...

    Thanks:
    regards:
    raghunadhs

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how to make my caprion bar's close button be invisible

    Disabling the 'x' close button can be done like so...

    http://www.vbforums.com/showpost.php...71&postcount=2
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Re: how to make my caprion bar's close button be invisible

    Great Rob.... it is working.thank you.. still i have 2 questions..
    Q1: can't i make the x button invisible?
    Q2: can you say what event will be occured suppose if user pressed X button (asume i did not write those 2 APIs,what u used in your example)? why i am asking is, suppose if any one of hte form termination or, unloading event will be invoked, why don't i write as "Load form1" in those events...?
    if the question is not clear pls let me know this....

    Thanks:
    regards:
    raghunadhs.v

    Quote Originally Posted by RobDog888
    Disabling the 'x' close button can be done like so...

    http://www.vbforums.com/showpost.php...71&postcount=2
    Last edited by raghunadhs; Aug 10th, 2007 at 06:15 AM. Reason: to make it more clarity

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how to make my caprion bar's close button be invisible

    You may be able to remove the 'x' button only but I dont know what the style constant is for it.

    No events will be invoked if the user clicks on the 'x' with my code.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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

    Re: how to make my caprion bar's close button be invisible

    There are 5 ways to check how a form is being closed. Each of them can be coded for.
    vb Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2. 'there are 5 unloadmode levels
    3.         Select Case UnloadMode
    4.             Case vbFormControlMenu 'UnloadMode 0
    5.                  'form is being unloaded via the Close
    6.                  'or by hitting the X in the upper right hand corner
    7.                  'command from the System menu
    8.             Case vbFormCode        'UnloadMode 1
    9.                  'Unload Me has been issued from code
    10.             Case vbAppWindows      'UnloadMode 2
    11.                  'Windows itself is closing
    12.             Case vbAppTaskManager  'UnloadMode 3
    13.                  'the Task Manager is closing the app
    14.             Case vbFormMDIForm     'UnloadMod 4
    15.                  'an MDI child form is closing because
    16.                  'its parent form is closing
    17.         End Select
    18. End Sub

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Re: how to make my caprion bar's close button be invisible

    Thanks Hack,
    thrugh your reply, i came to know how the form will be closed. now i will check, if any one of the levels what u have mentioned will be helpful to achieve my objective or not, and let you know the feed back.
    Thanks for your immediate responce.

    Hi Rob: what u said is right, i removed the X button and checked the form, it is not proper, and stylish also....Thanks for your suggestion....

    regards:
    raghunadhs


    [QUOTE=Hack]There are 5 ways to check how a form is being closed. Each of them can be coded for.[highlight=vb]Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    'there are 5 unloadmode levels
    Select Case UnloadMode

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how to make my caprion bar's close button be invisible

    No, when you have a min and max button it is the Standard in Windows to keep the 'x' close box and if you want to disable it or not is up to you but to try to remove just the one is not proper.

    Haveing the 'x' close button disabled is also proper standards in Windows.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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

    Re: how to make my caprion bar's close button be invisible

    Quote Originally Posted by RobDog888
    Haveing the 'x' close button disabled is also proper standards in Windows.
    Maybe, but it violates development standards where I am. For reasons known only to the people that created the standards, the X ALWAYS has to be available.

    This is not the first place that I've been where this is the case either.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: how to make my caprion bar's close button be invisible

    Well I just am commenting off of what is visible in Windows as its their standard for windows. Now if you have a workplace that has their own and it coincides with some other one then that still is a non-windows standard.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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

    Re: how to make my caprion bar's close button be invisible

    I know....I keep telling them that here. They won't listen.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Re: how to make my caprion bar's close button be invisible

    HI Hack & Rob,
    Actually, i am a fresher to industry and don't know the standards..etc. why i want to make the X button invisible is...
    My V.b application contains number of frames on a single form. every time one frame will be in visibility, remaining will be in invisible, if user clicks a command button on frame1, then frame2 will be appeared, frame 2 contains a "Back" Button. if user presses that "back" button again, frame1 will be appeared. my application is regarding to establishing a communication between 2 pc s via "winsock". so if user clicks X button by mistakenly to close the second frame(since he may not be aware of the app), entire communication will be lapsed.
    So at that time i thought that it was better to make my X button invisible. As per the knowledge, what u shared in previoius posts, i did that also , but it is not attractive.

    Now my question is Could you please suggest me a better way so that user should not be confused and he should not be able to close the app? (in my GUI i provided every thing like exit button, back button like that, but some people are cliking the X button)
    Thanks & regards:
    raghunadhs



    Quote Originally Posted by Hack
    I know....I keep telling them that here. They won't listen.

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