VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Dialog"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
' DIALOG.CLS -- DialogBox Class.
Private miParent As Object

' Create a new instance of the form.
Dim NewDlg As New Window

' Declarations for Window ownership API functions.
#If Win16 Then
    Private Declare Function SetParent Lib "User" _
        (ByVal hWndChild As Integer, _
        ByVal hWndNewParent As Integer) _
        As Integer
#Else
    Private Declare Function SetParent Lib "user32" _
        (ByVal hWndChild As Long, _
        ByVal hWndNewParent As Long) As Long
#End If

Public Property Get Name() As String
    Name = NewDlg.Caption
End Property
' DialogBox Create method.
Public Function Create(Owner As Object) As Dialog
    ' Set the Parent of this object.
    Set miParent = Owner
    ' Create the window.
    NewDlg.Create
    ' Set caption
    NewDlg.Caption = Me.Parent.Caption & ": Dialog"
    ' Set Parent window.
    Dim x As Long
    x = SetParent(NewDlg.hWnd, Me.Parent.hWnd)
    ' Return a reference to this object.
    Set Create = Me
End Function

' DialogBox Parent property
Public Property Get Parent()
    ' Return reference to module-level variable
    ' set by Create.
    Set Parent = miParent
End Property

