home *** CD-ROM | disk | FTP | other *** search
- Type Rectangle
- Left As Integer
- Top As Integer
- Right As Integer
- Bottom As Integer
- End Type
- Global OleRect As Rectangle
-
- Declare Function OleQueryBounds Lib "OLECLI" (ByVal LpOleObject As Long, aRect As Rectangle) As Integer
-
- '---------------------------------------
- ' Global Flags and Variables
- '---------------------------------------
- Global Save As Integer
- Global ContainsObject As Integer
- Global LinkFlag As Integer
- Global CancelFlag As Integer
- Global ClassDisplay As String
- Global RegIndex As Integer
-
- '---------------------------------------
- ' Global Constants
- '---------------------------------------
- 'Action
- Global Const OLE_CREATE_NEW = 0
- Global Const OLE_CREATE_FROM_FILE = 1
- Global Const OLE_COPY = 4
- Global Const OLE_PASTE = 5
- Global Const OLE_UPDATE = 6
- Global Const OLE_ACTIVATE = 7
- Global Const OLE_EXECUTE = 8
- Global Const OLE_CLOSE = 9
- Global Const OLE_DELETE = 10
- Global Const OLE_SAVE_TO_FILE = 11
- Global Const OLE_READ_FROM_FILE = 12
- Global Const OLE_CONVERT_TO_TYPE = 13
-
- 'ServerType
- Global Const OLE_LINKED = 0
- Global Const OLE_EMBEDDED = 1
- Global Const OLE_STATIC = 2
-
- 'UpdateOptions
- Global Const OLE_AUTOMATIC = 0
- Global Const OLE_FROZEN = 1
- Global Const OLE_MANUAL = 2
-
- 'Update Event Constants
- Global Const OLE_CHANGED = 0
- Global Const OLE_SAVED = 1
- Global Const OLE_CLOSED = 2
- Global Const OLE_RELEASE = 3
-
- Sub CenterForm (frmParent As Form, frmChild As Form)
- ' This procedure centers a child form over a parent form.
- ' Calling this routine loads the dialog. Use the Show method
- ' to display the dialog after calling this routine ( ie MyFrm.Show 1)
-
- ' get left offset
- l = frmParent.Left + ((frmParent.Width - frmChild.Width) / 2)
- If (l + frmChild.Width > Screen.Width) Then
- l = Screen.Width - frmChild.Width
- End If
-
- ' get top offset
- t = frmParent.Top + ((frmParent.Height - frmChild.Height) / 2)
- If (t + frmChild.Height > Screen.Height) Then
- t = Screen.Height - frmChild.Height
- End If
-
- ' center the child formfv
- frmChild.Move l, t
-
- End Sub
-
- Function FindDisplayName (ByVal S$) As String
- ' This function searches the registration database until it
- ' locates the specified class name. The function returns the
- ' class display name associated with the class name.
-
- Dim I As Integer
- Dim count As Integer
-
- count = frmMain.OleClient1.ServerClassCount - 1
-
- For I = 0 To count
- If (frmMain.OleClient1.ServerClasses(I) = S$) Then
- Exit For
- End If
- Next I
- 'set Global variable for future queries into reg database
- RegIndex = I
- FindDisplayName = frmMain.OleClient1.ServerClassesDisplay(RegIndex)
- End Function
-
- Sub HighLightTextBox ()
-
- FileForm.txtFileName.SelStart = 0
- FileForm.txtFileName.SelLength = Len(FileForm.txtFileName.Text)
- FileForm.txtFileName.SetFocus
-
- End Sub
-
- Sub InitEditObjectMenu ()
- ' This procedure sets up the edit object menu.
- ' It should be called each time a new object
- ' is displayed (insert, paste, paste link, open)
-
- frmMain.OleClient1.ServerClass = frmMain.OleClient1.Class
- Class$ = frmMain.OleClient1.ServerClassesDisplay(RegIndex)
-
- ' If more than one verb supported
- If frmMain.OleClient1.ServerVerbsCount > 1 Then
- frmMain.mnuEditObject(0).Caption = Class$ + "&Object"
- frmMain.mnuEditObject(0).Visible = -1
- frmMain.mnuEditObject(1).Visible = 0
- Call InitVerbsMenu
-
- Else
- ' one or less verbs supported
- ' get object's primary verb
- objVerb$ = frmMain.OleClient1.ServerVerbs(0)
- If objVerb$ <> "" Then
- objVerb$ = objVerb$ + " "
- End If
- frmMain.mnuEditObject(1).Caption = objVerb$ + Class$
- frmMain.mnuEditObject(1).Visible = -1
- frmMain.mnuEditObject(0).Visible = 0
- End If
- End Sub
-
- Sub InitVerbsMenu ()
- Dim I As Integer
- Dim vCount As Integer
-
- On Error Resume Next
- For I = 10 To 1 Step -1
- Unload frmMain.mnuEditObjVerb(I)
- Next I
- frmMain.OleClient1.ServerClass = frmMain.OleClient1.Class
- vCount = frmMain.OleClient1.ServerVerbsCount
- If (vCount) Then
- frmMain.mnuEditObjVerb(0).Caption = frmMain.OleClient1.ServerVerbs(0)
- For I = 1 To vCount - 1
- Load frmMain.mnuEditObjVerb(I)
- frmMain.mnuEditObjVerb(I).Caption = frmMain.OleClient1.ServerVerbs(I)
- frmMain.mnuEditObjVerb(I).Visible = -1
- Next I
- Else
- 'if no verbs are supported
- frmMain.mnuEditObjVerb(0).Caption = "Edit"
- End If
- End Sub
-
-