home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmOLE
- AutoRedraw = -1 'True
- Caption = "OLE Object Container"
- ClientHeight = 3330
- ClientLeft = 1140
- ClientTop = 3735
- ClientWidth = 5550
- Height = 4020
- Left = 1080
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 3330
- ScaleWidth = 5550
- Top = 3105
- Width = 5670
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 315
- Top = 105
- _version = 65536
- _extentx = 847
- _extenty = 847
- _stockprops = 0
- End
- Begin VB.OLE OLE1
- Height = 3252
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 5532
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- NegotiatePosition= 1 'Left
- Begin VB.Menu mnuFileNew
- Caption = "&New..."
- End
- Begin VB.Menu mnuSave
- Caption = "&Save As..."
- End
- Begin VB.Menu mnuOpen
- Caption = "&Open"
- End
- Begin VB.Menu sep1
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- End
- Begin VB.Menu sep2
- Caption = "-"
- End
- Begin VB.Menu mnuAbout
- Caption = "A&bout..."
- End
- End
- Begin VB.Menu mnuEdit
- Caption = "&Edit"
- Begin VB.Menu mnuCopy
- Caption = "&Copy"
- End
- Begin VB.Menu mnuDelete
- Caption = "&Delete"
- End
- Begin VB.Menu mnuSpecial
- Caption = "Paste &Special..."
- End
- Begin VB.Menu esep2
- Caption = "-"
- End
- Begin VB.Menu mnuUpdate
- Caption = "&Update "
- End
- End
- Begin VB.Menu mnuCloseOLE
- Caption = "&Close Ole Object"
- NegotiatePosition= 3 'Right
- End
- Begin VB.Menu mnuWindow
- Caption = "&Window"
- WindowList = -1 'True
- Begin VB.Menu mnuCascade
- Caption = "&Cascade"
- End
- Begin VB.Menu mnuTile
- Caption = "&Tile"
- End
- Begin VB.Menu mnuArrange
- Caption = "&Arrange Icons"
- End
- End
- Attribute VB_Name = "frmOLE"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_Load()
- On Error Resume Next
- Ole1.Move 0, 0
- Ole1.Height = Me.Height
- Ole1.Width = Me.Width
-
- Ole1.HostName = "OLE Container Control Demo"
- End Sub
- Private Sub Form_Resize()
- Ole1.SizeMode = vbOLESizeStretch
- Ole1.Height = Me.ScaleHeight
- Ole1.Width = Me.ScaleWidth
- End Sub
- Private Sub mnuAbout_Click()
- DisplayInstructions
- End Sub
- Private Sub mnuArrange_Click()
- MDIfrm.Arrange vbArrangeIcons
- End Sub
- Private Sub mnuCascade_Click()
- MDIfrm.Arrange vbCascade
- End Sub
- Private Sub mnuClose_Click()
- ' Close the OLE container control.
- Ole1.Close
- End Sub
- Private Sub mnuCloseOLE_Click()
- Ole1.Close
- End Sub
- Private Sub mnuCopy_Click()
- If Ole1.AppIsRunning = True Then
- Ole1.Copy
- Else
- Ole1.AppIsRunning = True
- If Ole1.AppIsRunning Then Ole1.Copy
- End If
- If Ole1.OLEType <> vbOLENone Then ' If the control contains a valid object...
- ' Display the hourglass mouse pointer.
- Screen.MousePointer = 11
- If Ole1.AppIsRunning Then
- Ole1.Copy ' Copy the object onto the Clipboard.
- End If
- End If
- Screen.MousePointer = 0
- End Sub
- Private Sub mnuDelete_Click()
- If Ole1.OLEType <> vbOLENone Then ' If the OLE container control contains a valid object...
- Ole1.Delete ' Delete the object, and then unload the form.
- End If
- Unload Me
- End Sub
- Private Sub mnuEdit_Click()
- On Error Resume Next
- If Err Then
- MsgBox "No contained object."
- End If
- If Ole1.PasteOK Then
- MDIfrm.ActiveForm.mnuSpecial.Enabled = True
- Else
- MDIfrm.ActiveForm.mnuSpecial.Enabled = False
- End If
- End Sub
- Private Sub mnuExit_Click()
- End
- End Sub
- Private Sub mnuFileNew_Click()
- NewObject
- End Sub
- Private Sub mnuOpen_Click()
- OpenObject
- End Sub
- Private Sub mnuSave_Click()
- OpenSave ("Save")
- End Sub
- Private Sub mnuSpecial_Click()
- If Ole1.PasteOK Then
- MDINew = False
- Ole1.PasteSpecialDlg
- Screen.MousePointer = 11
- UpdateCaption
- Screen.MousePointer = 0
- End If
- End Sub
- Private Sub mnuTile_Click()
- MDIfrm.Arrange vbTileHorizontal
- End Sub
- Private Sub mnuUpdate_Click()
- Screen.MousePointer = 11
- Ole1.Update
- Screen.MousePointer = 0
- End Sub
- Private Sub Ole1_ObjectMove(Left As Single, Top As Single, Width As Single, Height As Single)
- Ole1.Move Ole1.Top, Ole1.Left, Width, Height
- Ole1.Move Top, Left, Ole1.Width, Ole1.Height
- End Sub
- Private Sub Ole1_Updated(Code As Integer)
- Ole1.SizeMode = vbOLESizeAutoSize
- End Sub
-