PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Removing The Border & Title of an MDI Parent Form-VBForums
Results 1 to 12 of 12

Thread: Removing The Border & Title of an MDI Parent Form

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2008
    Posts
    60

    Removing The Border & Title of an MDI Parent Form

    Is it possible to remove the border and titlebar of an mdi parent form in vb6? I've been searching the net for a way and have yet to find one. Any help would be much appreciated!

  2. #2
    Member
    Join Date
    Feb 2006
    Posts
    63

    Re: Removing The Border & Title of an MDI Parent Form

    Try this.

    vb Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    4. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    5.  
    6. Const WS_CAPTION = &HC00000
    7. Const WS_SYSMENU = &H80000
    8. Const WS_MINIMIZEBOX = &H20000
    9. Const WS_MAXIMIZEBOX = &H10000
    10. Const GWL_STYLE = (-16)
    11.  
    12. Private Sub MDIForm_Load()
    13.     Dim L As Long
    14.    
    15.     L = GetWindowLong(Me.hwnd, GWL_STYLE)
    16.     L = L And Not (WS_MINIMIZEBOX)
    17.     L = L And Not (WS_MAXIMIZEBOX)
    18.     L = L Xor WS_CAPTION
    19.     L = SetWindowLong(Me.hwnd, GWL_STYLE, L)
    20.  
    21. End Sub

  3. #3
    Lively Member
    Join Date
    Jul 2007
    Posts
    74

    Re: Removing The Border & Title of an MDI Parent Form

    How would you remove the single border from the above code? So that this removes the single boder and stop from resizing the MDIform.

  4. #4
    New Member
    Join Date
    Mar 2009
    Posts
    2

    Re: Removing The Border & Title of an MDI Parent Form

    Quote Originally Posted by mathy2007 View Post
    How would you remove the single border from the above code? So that this removes the single boder and stop from resizing the MDIform
    I was looking to do the exact samething last night ... and eventually found the solution elsewhere :

    just define another constant :

    Code:
    Const WS_THICKFRAME = &H40000
    and use the following ( NB. you no longer need to "manually" remove the min and max boxes )

    Code:
        Dim L As Long
        
        L = GetWindowLong(Me.hwnd, GWL_STYLE)
        L = L And Not (WS_THICKFRAME)
        L = L Xor WS_CAPTION
        L = SetWindowLong(Me.hwnd, GWL_STYLE, L)

  5. #5
    Junior Member
    Join Date
    Apr 2002
    Location
    Alkmaar, the Netherlands
    Posts
    25

    Thumbs up Re: Removing The Border & Title of an MDI Parent Form

    works great! thanks!

    as long as you dont have a statusbar on the form

    i am using a mdiform with a statusbar on the bottom and now the resize function is moved to the statusbar, which looks funny, but is not what i want

    i tried using the hwnd of the statusbar instead, but that didnt work either

    does anyone have a clue how to create an mdiform which cant be resized and has no caption/controlbox and no border ?
    Women forgive but never forget. Men forget but never forgive.

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,381

    Re: Removing The Border & Title of an MDI Parent Form

    That resize/grab handle on the status bar was always there, correct? I don't know if you can remove it without taking control over drawing the statusbar yourself and/or preventing mouse events over that corner. However, you can disable the statusbar which prevents users from dragging that corner.
    Code:
    Private Declare Function EnableWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    
    ' Example:
    EnableWindow MDIForm1.StatusBar1.hwnd, 0& ' 0&=False, 1&=True
    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}

  7. #7
    Junior Member
    Join Date
    Apr 2002
    Location
    Alkmaar, the Netherlands
    Posts
    25

    Thumbs up Re: Removing The Border & Title of an MDI Parent Form

    wow thats what i call a quick reply

    the resize/grab handle was always there indeed, but normally it doesnt resize the statusbar itself. normally when you drag the handle the mdi form itself resizes

    your code works great! thanks!
    the resize/grab handle is still there but doesnt do anything anymore


    double thumbs up
    Women forgive but never forget. Men forget but never forgive.

  8. #8
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Removing The Border & Title of an MDI Parent Form

    The StatusBar resize/grab handle is only visible if it's Align property is set to 2 - vbAlignBottom. You could add a PictureBox to the MDI form aligned to the bottom and then place the StatusBar in the PictureBox. Since the StatusBar is in the PictureBox it can no longer be Aligned. Use the PictureBoxes Resize event to adjust the StatusBar to completely fill the PictureBox client area.

    Code:
    Private Sub Picture1_Resize()
        StatusBar1.Move 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
    End Sub

  9. #9
    Junior Member
    Join Date
    Apr 2002
    Location
    Alkmaar, the Netherlands
    Posts
    25

    Thumbs up Re: Removing The Border & Title of an MDI Parent Form

    thanks! nice tip!
    Women forgive but never forget. Men forget but never forgive.

  10. #10
    New Member
    Join Date
    May 2018
    Posts
    4

    Thumbs up Re: Removing The Border & Title of an MDI Parent Form

    Thanks a lot bro

  11. #11
    New Member
    Join Date
    May 2018
    Posts
    4

    Re: Removing The Border & Title of an MDI Parent Form

    Quote Originally Posted by LaVolpe View Post
    That resize/grab handle on the status bar was always there, correct? I don't know if you can remove it without taking control over drawing the statusbar yourself and/or preventing mouse events over that corner. However, you can disable the statusbar which prevents users from dragging that corner.
    Code:
    Private Declare Function EnableWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    
    ' Example:
    EnableWindow MDIForm1.StatusBar1.hwnd, 0& ' 0&=False, 1&=True

    Try "bigmox68 "( Mar 31st, 2009, 02:57 PM #4) his post. it's an great idea.

  12. #12
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,113

    Re: Removing The Border & Title of an MDI Parent Form

    doss....you DO realize this is a 9 year old+ thread?????????????????????????????????

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width