home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch19code / dialog.cls < prev    next >
Text File  |  1995-08-14  |  1KB  |  51 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Dialog"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. ' DIALOG.CLS -- DialogBox Class.
  9. Private miParent As Object
  10.  
  11. ' Create a new instance of the form.
  12. Dim NewDlg As New Window
  13.  
  14. ' Declarations for Window ownership API functions.
  15. #If Win16 Then
  16.     Private Declare Function SetParent Lib "User" _
  17.         (ByVal hWndChild As Integer, _
  18.         ByVal hWndNewParent As Integer) _
  19.         As Integer
  20. #Else
  21.     Private Declare Function SetParent Lib "user32" _
  22.         (ByVal hWndChild As Long, _
  23.         ByVal hWndNewParent As Long) As Long
  24. #End If
  25.  
  26. Public Property Get Name() As String
  27.     Name = NewDlg.Caption
  28. End Property
  29. ' DialogBox Create method.
  30. Public Function Create(Owner As Object) As Dialog
  31.     ' Set the Parent of this object.
  32.     Set miParent = Owner
  33.     ' Create the window.
  34.     NewDlg.Create
  35.     ' Set caption
  36.     NewDlg.Caption = Me.Parent.Caption & ": Dialog"
  37.     ' Set Parent window.
  38.     Dim x As Long
  39.     x = SetParent(NewDlg.hWnd, Me.Parent.hWnd)
  40.     ' Return a reference to this object.
  41.     Set Create = Me
  42. End Function
  43.  
  44. ' DialogBox Parent property
  45. Public Property Get Parent()
  46.     ' Return reference to module-level variable
  47.     ' set by Create.
  48.     Set Parent = miParent
  49. End Property
  50.  
  51.