home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 3.ddi / INSERT.FR_ / INSERT.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  3.5 KB  |  106 lines

  1. VERSION 2.00
  2. Begin Form dlgInsert 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Insert Object"
  5.    Height          =   2775
  6.    Left            =   3120
  7.    LinkMode        =   1  'Source
  8.    LinkTopic       =   "Form2"
  9.    MaxButton       =   0   'False
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   2370
  12.    ScaleWidth      =   4260
  13.    Top             =   1800
  14.    Width           =   4380
  15.    Begin ListBox lstObjects 
  16.       Height          =   1395
  17.       Left            =   120
  18.       TabIndex        =   3
  19.       Top             =   720
  20.       Width           =   2535
  21.    End
  22.    Begin CommandButton cmdOK 
  23.       Caption         =   "OK"
  24.       Default         =   -1  'True
  25.       Height          =   495
  26.       Left            =   2880
  27.       TabIndex        =   1
  28.       Top             =   720
  29.       Width           =   1215
  30.    End
  31.    Begin CommandButton cmdCancel 
  32.       Cancel          =   -1  'True
  33.       Caption         =   "Cancel"
  34.       Height          =   495
  35.       Left            =   2880
  36.       TabIndex        =   2
  37.       Top             =   1320
  38.       Width           =   1215
  39.    End
  40.    Begin Label Label1 
  41.       Caption         =   "Object Type:"
  42.       Height          =   255
  43.       Left            =   120
  44.       TabIndex        =   0
  45.       Top             =   360
  46.       Width           =   1335
  47.    End
  48. Sub cmdCancel_Click ()
  49.   Unload dlgInsert
  50.   CancelFlag = True
  51. End Sub
  52. Sub cmdOK_Click ()
  53.   On Error Resume Next
  54.   ' determine class name
  55.   ' since class names without associated protocols aren't included the lstObjects
  56.   ' list box, the FindClass function is used to match the server name displayed in
  57.   ' the list box with the appropriate Class name
  58.   ClassDisplay = lstObjects.List(lstObjects.ListIndex)
  59.   frmMain.OleClient1.Class = FindClassName(ClassDisplay)
  60.   ' object is embedded
  61.   frmMain.OleClient1.ServerType = OLE_EMBEDDED
  62.   ' set cursor to hourglass
  63.   Screen.MousePointer = 11
  64.   Unload dlgInsert
  65. End Sub
  66. Function FindClassName (ByVal S$) As String
  67.   ' This function searches the ServerClassDisplay items in the registration
  68.   ' database until it locates the string that was selected in the lstObjects
  69.   ' list box. The function returns the Class name associated with the
  70.   ' selected ClassDisplay name. You do not need this routine if you
  71.   ' simply display the Class names in the lstObects list box, however,
  72.   ' Class names are not always recognizable by the user.
  73.   Dim I As Integer
  74.   Dim Count As Integer
  75.   Count = frmMain.OleClient1.ServerClassCount - 1
  76.   For I = 0 To Count
  77.     If (frmMain.OleClient1.ServerClassesDisplay(I) = S$) Then
  78.       Exit For
  79.     End If
  80.   Next I
  81.     'set global index variable for future reg database queries
  82.     RegIndex = I
  83.     FindClassName = frmMain.OleClient1.ServerClasses(RegIndex)
  84. End Function
  85. Sub Form_Load ()
  86.   Dim I As Integer
  87.   Dim Count As Integer
  88.   Screen.MousePointer = 11
  89.   Count = frmMain.OleClient1.ServerClassCount - 1
  90.   'display available server apps in list box
  91.   For I = 0 To Count
  92.     'check to make sure the server class supports at least one protocol
  93.     'before adding it to the list box
  94.     frmMain.OleClient1.ServerClass = frmMain.OleClient1.ServerClasses(I)
  95.     If (frmMain.OleClient1.ServerProtocolCount) Then
  96.       lstObjects.AddItem frmMain.OleClient1.ServerClassesDisplay(I)
  97.       'lstObjects.List(I) = frmMain.OleClient1.ServerClassesDisplay(I)
  98.     End If
  99.   Next I
  100.   lstObjects.ListIndex = 0
  101.   Screen.MousePointer = 0
  102. End Sub
  103. Sub lstObjects_DblClick ()
  104.   Call cmdOK_Click
  105. End Sub
  106.