home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / OLECONT / CONTCHLD.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1996-10-15  |  5.3 KB  |  191 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form ChildForm 
  4.    AutoRedraw      =   -1  'True
  5.    Caption         =   "OLE Object Container"
  6.    ClientHeight    =   3330
  7.    ClientLeft      =   1140
  8.    ClientTop       =   3735
  9.    ClientWidth     =   5550
  10.    LinkTopic       =   "Form1"
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   3330
  13.    ScaleWidth      =   5550
  14.    Begin MSComDlg.CommonDialog CommonDialog1 
  15.       Left            =   315
  16.       Top             =   105
  17.       _ExtentX        =   847
  18.       _ExtentY        =   847
  19.       FilterIndex     =   4096
  20.       FontSize        =   8.40483e-38
  21.    End
  22.    Begin VB.OLE OLE1 
  23.       Height          =   3252
  24.       Left            =   0
  25.       TabIndex        =   0
  26.       Top             =   0
  27.       Width           =   5532
  28.    End
  29.    Begin VB.Menu mnuFile 
  30.       Caption         =   "&File"
  31.       NegotiatePosition=   1  'Left
  32.       Begin VB.Menu mnuFileNew 
  33.          Caption         =   "&New..."
  34.       End
  35.       Begin VB.Menu mnuSave 
  36.          Caption         =   "&Save As..."
  37.       End
  38.       Begin VB.Menu mnuOpen 
  39.          Caption         =   "&Open"
  40.       End
  41.       Begin VB.Menu sep1 
  42.          Caption         =   "-"
  43.       End
  44.       Begin VB.Menu mnuExit 
  45.          Caption         =   "E&xit"
  46.       End
  47.       Begin VB.Menu sep2 
  48.          Caption         =   "-"
  49.       End
  50.       Begin VB.Menu mnuAbout 
  51.          Caption         =   "A&bout..."
  52.       End
  53.    End
  54.    Begin VB.Menu mnuEdit 
  55.       Caption         =   "&Edit"
  56.       Begin VB.Menu mnuCopy 
  57.          Caption         =   "&Copy"
  58.       End
  59.       Begin VB.Menu mnuDelete 
  60.          Caption         =   "&Delete"
  61.       End
  62.       Begin VB.Menu mnuSpecial 
  63.          Caption         =   "Paste &Special..."
  64.       End
  65.       Begin VB.Menu esep2 
  66.          Caption         =   "-"
  67.       End
  68.       Begin VB.Menu mnuUpdate 
  69.          Caption         =   "&Update "
  70.       End
  71.    End
  72.    Begin VB.Menu mnuCloseOLE 
  73.       Caption         =   "&Close Ole Object"
  74.       NegotiatePosition=   3  'Right
  75.    End
  76.    Begin VB.Menu mnuWindow 
  77.       Caption         =   "&Window"
  78.       WindowList      =   -1  'True
  79.       Begin VB.Menu mnuCascade 
  80.          Caption         =   "&Cascade"
  81.       End
  82.       Begin VB.Menu mnuTile 
  83.          Caption         =   "&Tile"
  84.       End
  85.       Begin VB.Menu mnuArrange 
  86.          Caption         =   "&Arrange Icons"
  87.       End
  88.    End
  89. Attribute VB_Name = "ChildForm"
  90. Attribute VB_GlobalNameSpace = False
  91. Attribute VB_Creatable = False
  92. Attribute VB_PredeclaredId = True
  93. Attribute VB_Exposed = False
  94. Option Explicit
  95. Private Sub Form_Load()
  96. On Error Resume Next
  97.     OLE1.Move 0, 0
  98.     OLE1.Height = Me.Height
  99.     OLE1.Width = Me.Width
  100.           
  101.     OLE1.HostName = "OLE Container Control Demo"
  102. End Sub
  103. Private Sub mnuAbout_Click()
  104.     DisplayInstructions
  105. End Sub
  106. Private Sub mnuArrange_Click()
  107.     ParentForm.Arrange vbArrangeIcons
  108. End Sub
  109. Private Sub mnuCascade_Click()
  110.     ParentForm.Arrange vbCascade
  111. End Sub
  112. Private Sub mnuClose_Click()
  113.     ' Close the OLE container control.
  114.     OLE1.Close
  115. End Sub
  116. Private Sub mnuCloseOLE_Click()
  117.     OLE1.Close
  118. End Sub
  119. Private Sub mnuCopy_Click()
  120.     If OLE1.AppIsRunning = True Then
  121.         OLE1.Copy
  122.     Else
  123.         OLE1.AppIsRunning = True
  124.         If OLE1.AppIsRunning Then OLE1.Copy
  125.     End If
  126.     If OLE1.OLEType <> vbOLENone Then   ' If the control contains a valid object...
  127.         ' Display the hourglass mouse pointer.
  128.         Screen.MousePointer = 11
  129.         If OLE1.AppIsRunning Then
  130.            OLE1.Copy                    ' Copy the object onto the Clipboard.
  131.         End If
  132.     End If
  133.     Screen.MousePointer = 0
  134. End Sub
  135. Private Sub mnuDelete_Click()
  136.     If OLE1.OLEType <> vbOLENone Then   ' If the OLE container control contains a valid object...
  137.         OLE1.Delete                     ' Delete the object, and then unload the form.
  138.     End If
  139.         Unload Me
  140. End Sub
  141. Private Sub mnuEdit_Click()
  142.     On Error Resume Next
  143.     If Err Then
  144.         MsgBox "No contained object."
  145.     End If
  146.     If OLE1.PasteOK Then
  147.         ParentForm.ActiveForm.mnuSpecial.Enabled = True
  148.     Else
  149.         ParentForm.ActiveForm.mnuSpecial.Enabled = False
  150.     End If
  151. End Sub
  152. Private Sub mnuExit_Click()
  153.     End
  154. End Sub
  155. Private Sub mnuFileNew_Click()
  156.     NewObject
  157. End Sub
  158. Private Sub mnuOpen_Click()
  159.     OpenObject
  160. End Sub
  161. Private Sub mnuSave_Click()
  162.     OpenSave ("Save")
  163. End Sub
  164. Private Sub mnuSpecial_Click()
  165.     If OLE1.PasteOK Then
  166.         MDINew = False
  167.         OLE1.PasteSpecialDlg
  168.         Screen.MousePointer = 11
  169.         UpdateCaption
  170.         Screen.MousePointer = 0
  171.     End If
  172. End Sub
  173. Private Sub mnuTile_Click()
  174.     ParentForm.Arrange vbTileHorizontal
  175. End Sub
  176. Private Sub mnuUpdate_Click()
  177.     Screen.MousePointer = 11
  178.     OLE1.Update
  179.     Screen.MousePointer = 0
  180. End Sub
  181. Private Sub Ole1_ObjectMove(Left As Single, Top As Single, Width As Single, Height As Single)
  182.     OLE1.Move OLE1.Left, OLE1.Top, Width, Height
  183.     OLE1.Move Left, Top, OLE1.Width, OLE1.Height
  184. End Sub
  185. Private Sub OLE1_Resize(HeightNew As Single, WidthNew As Single)
  186.     OLE1.SizeMode = vbOLESizeAutoSize
  187. End Sub
  188. Private Sub Ole1_Updated(Code As Integer)
  189.     OLE1.SizeMode = vbOLESizeAutoSize
  190. End Sub
  191.