vbAccelerator - Contents of code file: fMinMax.frm

VERSION 5.00
Begin VB.Form frmMinMax 
   Caption         =   "Sub-Classing Demo 1"
   ClientHeight    =   3180
   ClientLeft      =   5265
   ClientTop       =   2010
   ClientWidth     =   3780
   Icon            =   "fMinMax.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3180
   ScaleWidth      =   3780
   Begin VB.Image imgVbAccel 
      Height          =   195
      Left            =   285
      Picture         =   "fMinMax.frx":014A
      Top             =   225
      Width           =   1185
   End
   Begin VB.Label lblInfo 
      Caption         =   "This form can't be made smaller than 128 x 128
       pixels."
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   675
      Left            =   60
      TabIndex        =   0
      Top             =   600
      Width           =   1755
   End
   Begin VB.Label lblBlack 
      BackColor       =   &H00000000&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Label1"
      Height          =   495
      Left            =   60
      TabIndex        =   1
      Top             =   60
      Width           =   1755
   End
End
Attribute VB_Name = "frmMinMax"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Private Type POINTAPI
    x As Long
    y As Long
End Type
Private Type MINMAXINFO
    ptReserved As POINTAPI
    ptMaxSize As POINTAPI
    ptMaxPosition As POINTAPI
    ptMinTrackSize As POINTAPI
    ptMaxTrackSize As POINTAPI
End Type
Private Const WM_GETMINMAXINFO = &H24

Implements ISubclass
Private m_emr As EMsgResponse

Private Sub Form_Load()
    AttachMessage Me, Me.hwnd, WM_GETMINMAXINFO
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    DetachMessage Me, Me.hwnd, WM_GETMINMAXINFO
End Sub

Private Property Let ISubclass_MsgResponse(ByVal RHS As SSubTimer6.EMsgResponse)
    m_emr = RHS
End Property

Private Property Get ISubclass_MsgResponse() As SSubTimer6.EMsgResponse
    Debug.Print CurrentMessage
    m_emr = emrConsume
    ISubclass_MsgResponse = m_emr
End Property

Private Function ISubclass_WindowProc(ByVal hwnd As Long, ByVal iMsg As Long,
 ByVal wParam As Long, ByVal lParam As Long) As Long
Dim mmiT As MINMAXINFO

    ' Copy parameter to local variable for processing
    CopyMemory mmiT, ByVal lParam, LenB(mmiT)
    
    ' Minimium width and height for sizing
    mmiT.ptMinTrackSize.x = 128
    mmiT.ptMinTrackSize.y = 128
        
    ' Copy modified results back to parameter
    CopyMemory ByVal lParam, mmiT, LenB(mmiT)

End Function