[vb6] Hoe maak je MDI-parent form 'non-sizable'?

Pagina: 1
Acties:

  • EmilneM
  • Registratie: December 2001
  • Laatst online: 15-09-2023
Voor het weergeven op verschillende pc's met verschillende resoluties wil ik een non-sizable applicatie bouwen. Uitgangspunt is echter een MDI-parent form waar standaard de borderstyle niet in te stellen is. Ik heb al op MSDN gezocht maar daar worden alleen oplossingen gegeven voor MDI-childs die niet sizable mogen zijn.

Hoe maak ik het MDI-parent form 'non-sizable'?

Verwijderd

Ja daar ben ik weer, deze was makkelijker dan de vorige ;)

Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000

Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd 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 Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Sub MDIForm_Load()
    
    
    Dim lSysMenu        As Long
    Dim lCount          As Long
    Dim lFormStyle      As Long
    
    '* Zorg ervoor dat 'size' en 'maximize' item uit het form-menu verdwijnen.
    lSysMenu = GetSystemMenu(Me.hWnd, False)
    If lSysMenu Then
       lCount = GetMenuItemCount(lSysMenu)
       If lCount Then
          Call RemoveMenu(lSysMenu, 2, MF_BYPOSITION Or MF_REMOVE)
          Call RemoveMenu(lSysMenu, 3, MF_BYPOSITION Or MF_REMOVE)
          Call DrawMenuBar(Me.hWnd)
       End If
    End If
    
    '* maak maximize-button disabled
    lFormStyle = GetWindowLong(hWnd, GWL_STYLE)
    lFormStyle = lFormStyle And Not WS_MAXIMIZEBOX
    Call SetWindowLong(hWnd, GWL_STYLE, lFormStyle)
End Sub

  • EmilneM
  • Registratie: December 2001
  • Laatst online: 15-09-2023
Verwijderd schreef op 07 October 2003 @ 18:24:
Ja daar ben ik weer, deze was makkelijker dan de vorige ;)
Werkt goed! Als ik op de hoeken van het scherm ga staan is alleen de resize-cursor nog zichtbaar. Hoe krijg ik deze daar weg?