home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / contchld.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  5.3 KB  |  194 lines

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