home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l405 / 1.ddi / OLE2CHLD.FR_ / OLE2CHLD.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  6.1 KB  |  231 lines

  1. VERSION 2.00
  2. Begin Form frmOLE 
  3.    Caption         =   "OLE Object Container"
  4.    ClientHeight    =   2280
  5.    ClientLeft      =   2010
  6.    ClientTop       =   3735
  7.    ClientWidth     =   4440
  8.    Height          =   2970
  9.    Left            =   1950
  10.    LinkTopic       =   "Form1"
  11.    MDIChild        =   -1  'True
  12.    ScaleHeight     =   2280
  13.    ScaleWidth      =   4440
  14.    Top             =   3105
  15.    Width           =   4560
  16.    Begin CommonDialog CMDialog1 
  17.       Left            =   15
  18.       Top             =   15
  19.    End
  20.    Begin OLE Ole1 
  21.       fFFHk           =   -1  'True
  22.       Height          =   2295
  23.       Left            =   -135
  24.       SizeMode        =   2  'AutoSize
  25.       TabIndex        =   0
  26.       Top             =   -15
  27.       Width           =   4455
  28.    End
  29.    Begin Menu mnuFile 
  30.       Caption         =   "&File"
  31.       Begin Menu mnuFileNew 
  32.          Caption         =   "&New..."
  33.       End
  34.       Begin Menu mnuSave 
  35.          Caption         =   "&Save As..."
  36.       End
  37.       Begin Menu mnuOpen 
  38.          Caption         =   "&Open"
  39.       End
  40.       Begin Menu sep1 
  41.          Caption         =   "-"
  42.       End
  43.       Begin Menu mnuExit 
  44.          Caption         =   "E&xit"
  45.       End
  46.       Begin Menu sep2 
  47.          Caption         =   "-"
  48.       End
  49.       Begin Menu mnuAbout 
  50.          Caption         =   "A&bout..."
  51.       End
  52.    End
  53.    Begin Menu mnuEdit 
  54.       Caption         =   "&Edit"
  55.       Begin Menu mnuObject 
  56.          Caption         =   "&Object"
  57.          Begin Menu mnuVerbs 
  58.             Caption         =   "verb"
  59.             Index           =   0
  60.          End
  61.       End
  62.       Begin Menu esup1 
  63.          Caption         =   "-"
  64.       End
  65.       Begin Menu mnuCut 
  66.          Caption         =   "Cu&t"
  67.       End
  68.       Begin Menu mnuCopy 
  69.          Caption         =   "&Copy"
  70.       End
  71.       Begin Menu mnuPaste 
  72.          Caption         =   "&Paste"
  73.       End
  74.       Begin Menu mnuSpecial 
  75.          Caption         =   "Paste &Special..."
  76.       End
  77.       Begin Menu mnuDelete 
  78.          Caption         =   "&Delete"
  79.       End
  80.       Begin Menu esep2 
  81.          Caption         =   "-"
  82.       End
  83.       Begin Menu mnuUpdate 
  84.          Caption         =   "&Update "
  85.       End
  86.    End
  87.    Begin Menu mnuWindow 
  88.       Caption         =   "&Window"
  89.       WindowList      =   -1  'True
  90.       Begin Menu mnuCascade 
  91.          Caption         =   "&Cascade"
  92.       End
  93.       Begin Menu mnuTile 
  94.          Caption         =   "&Tile"
  95.       End
  96.       Begin Menu mnuArrange 
  97.          Caption         =   "&Arrange Icons"
  98.       End
  99.    End
  100. Option Explicit
  101. Sub Form_Load ()
  102. On Error Resume Next
  103. Ole1.Move 0, 0
  104. ' Only display Insert Object dialog if File New was selected.
  105. If MDINew Then
  106.   Ole1.Action = OLE_INSERT_OBJ_DLG
  107.   Ole1.Height = Me.Height
  108.   Ole1.Width = Me.Width
  109. End If
  110. Ole1.HostName = "OLE 2.0 Demo"
  111. End Sub
  112. Sub Form_Resize ()
  113.   Ole1.SizeMode = OLE_SIZE_STRETCH
  114.   Ole1.Height = Me.ScaleHeight
  115.   Ole1.Width = Me.ScaleWidth
  116. End Sub
  117. Sub mnuAbout_Click ()
  118.   AboutBox.Show
  119. End Sub
  120. Sub mnuArrange_Click ()
  121.   MDIfrm.Arrange ARRANGE_ICONS
  122. End Sub
  123. Sub mnuCascade_Click ()
  124.   MDIfrm.Arrange CASCADE
  125. End Sub
  126. Sub mnuCopy_Click ()
  127.   If Ole1.OLEType <> OLE_NONE Then  ' If the control contains a valid object.
  128.     ' Display hourglass
  129.     Screen.MousePointer = 11
  130.     If Ole1.AppIsRunning Then
  131.       Ole1.Action = OLE_COPY          ' Copy object to the Clipboard.
  132.     Else
  133.       ' Set Verb to activate hidden
  134.       Ole1.Verb = VERB_HIDE
  135.       Ole1.Action = OLE_ACTIVATE
  136.       Ole1.Action = OLE_COPY          ' Copy object to the Clipboard.
  137.       ' Set verb back to default.
  138.       Ole1.Verb = VERB_PRIMARY
  139.     End If
  140.     ' Restore mouse cursor.
  141.     Screen.MousePointer = 0
  142.   End If
  143. End Sub
  144. Sub mnuCut_Click ()
  145.   mnuCopy_Click   ' Copy object to the clipboard.
  146.   mnuDelete_Click ' Delete object and unload the form.
  147. End Sub
  148. Sub mnuDelete_Click ()
  149. If Ole1.OLEType <> OLE_NONE Then  ' If OLE control contains a valid object.
  150.     Ole1.Action = OLE_DELETE      ' Delete the object, then unload the form.
  151. End If
  152.   Unload Me
  153. End Sub
  154. Sub mnuEdit_Click ()
  155. Dim Verb
  156. Dim LargestCurrentVerb As Integer
  157. Ole1.Action = OLE_FETCH_VERBS
  158. LargestCurrentVerb = Ole1.ObjectVerbsCount - 1
  159. If MDIfrm.ActiveForm.Ole1.OLEType <> OLE_NONE Then
  160.   For Verb = 1 To LargestCurrentVerb
  161.     mnuVerbs(Verb).Caption = Ole1.ObjectVerbs(Verb)
  162.     mnuVerbs(Verb).Visible = True
  163.   Next Verb
  164.   For Verb = LargestCurrentVerb + 1 To VerbMax
  165.      mnuVerbs(Verb).Visible = False
  166.   Next Verb
  167. End If
  168. If MDIfrm.ActiveForm.Ole1.PasteOK Then
  169.   MDIfrm.ActiveForm.mnuPaste.Enabled = True
  170.   MDIfrm.ActiveForm.mnuSpecial.Enabled = True
  171.   MDIfrm.ActiveForm.mnuPaste.Enabled = False
  172.   MDIfrm.ActiveForm.mnuSpecial.Enabled = False
  173. End If
  174. End Sub
  175. Sub mnuExit_Click ()
  176.     End
  177. End Sub
  178. Sub mnuFileNew_Click ()
  179.   NewObject
  180. End Sub
  181. Sub mnuOpen_Click ()
  182.   OpenObject
  183. End Sub
  184. Sub mnuPaste_Click ()
  185.   If Ole1.PasteOK Then
  186.     MDINew = False
  187.     ' Display new form.
  188.     ' NewOleForm
  189.     ' Paste Clipboard contents.
  190.     Ole1.Action = OLE_PASTE
  191.     ' Set form properties.
  192.     UpdateCaption
  193.   Else
  194.     MsgBox "Can't Paste"
  195.   End If
  196. End Sub
  197. Sub mnuSave_Click ()
  198.     OpenSave ("Save")
  199. End Sub
  200. Sub mnuSpecial_Click ()
  201. If Ole1.PasteOK Then
  202.   MDINew = False
  203.   Ole1.Action = OLE_PASTE_SPECIAL_DLG
  204.   Screen.MousePointer = 11
  205.   UpdateCaption
  206.   Screen.MousePointer = 0
  207. End If
  208. End Sub
  209. Sub mnuTile_Click ()
  210.   MDIfrm.Arrange TILE_HORIZONTAL
  211. End Sub
  212. Sub mnuUpdate_Click ()
  213.   Screen.MousePointer = 11
  214.   Ole1.Action = OLE_UPDATE
  215.   Screen.MousePointer = 0
  216. End Sub
  217. Sub mnuVerbs_Click (index As Integer)
  218. Ole1.Verb = index
  219. Ole1.Action = OLE_ACTIVATE
  220. End Sub
  221. Sub ole1_Resize (heightnew As Single, widthnew As Single)
  222. 'This routine relies on the fact that the form is in TWIPS
  223. 'such that ScaleHeight/ScaleWidth for the form are comparable
  224. 'with the dimensions of the OLE control
  225. Me.Height = Me.Height + (heightnew - Me.ScaleHeight)
  226. Me.Width = Me.Width + (widthnew - Me.ScaleWidth)
  227. End Sub
  228. Sub Ole1_Updated (Code As Integer)
  229.   Ole1.SizeMode = OLE_SIZE_AUTOSIZE
  230. End Sub
  231.