home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form MainForm
- Caption = "Novell DLL's Example Program"
- ClientHeight = 5475
- ClientLeft = 105
- ClientTop = 375
- ClientWidth = 6600
- Height = 5880
- Icon = 0
- Left = 45
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 5475
- ScaleWidth = 6600
- Top = 30
- Width = 6720
- Begin CommandButton Command3
- Caption = "Map Drives"
- Height = 375
- Left = 4620
- TabIndex = 11
- Top = 4800
- Width = 1215
- End
- Begin CommandButton Command2
- Caption = "Detach"
- Height = 375
- Left = 2940
- TabIndex = 4
- Top = 4800
- Width = 1215
- End
- Begin CommandButton Command1
- Caption = "Attach"
- Height = 375
- Left = 720
- TabIndex = 3
- Top = 4800
- Width = 1215
- End
- Begin ListBox List3
- Height = 1590
- Left = 4470
- TabIndex = 5
- Top = 3030
- Width = 1485
- End
- Begin ListBox List2
- Height = 1590
- Left = 2700
- TabIndex = 1
- Top = 3030
- Width = 1605
- End
- Begin ListBox List1
- Height = 1590
- Left = 540
- Sorted = -1 'True
- TabIndex = 0
- Top = 3030
- Width = 1605
- End
- Begin TextBox Text4
- Height = 345
- Left = 4770
- TabIndex = 8
- Text = "Text4"
- Top = 1620
- Width = 1215
- End
- Begin TextBox Text3
- Height = 345
- Left = 2940
- TabIndex = 7
- Text = "Text3"
- Top = 1620
- Width = 1215
- End
- Begin TextBox Text2
- Height = 345
- Left = 450
- TabIndex = 6
- Text = "Text2"
- Top = 1620
- Width = 1215
- End
- Begin TextBox Text1
- Height = 345
- Left = 450
- TabIndex = 2
- Text = "Text1"
- Top = 510
- Width = 1215
- End
- Begin TextBox Hidden2
- Height = 285
- Left = 5370
- TabIndex = 10
- Text = "Hidden2"
- Top = 360
- Visible = 0 'False
- Width = 1215
- End
- Begin TextBox Hidden1
- Height = 315
- Left = 5370
- TabIndex = 9
- Text = "Hidden1"
- Top = 30
- Visible = 0 'False
- Width = 1215
- End
- DefInt A-Z
- Dim FileServerNames$(8)
- Sub Command1_Click ()
- ' ================================
- ' First check to see if already attached and if item is marked in List1
- If MainForm.List1.ListIndex = -1 Then
- Txt$ = "You must first select a server "
- Txt$ = Txt$ + "to attach to!"
- MsgBox Txt$, 32, "Must Pick Server"
- Exit Sub
- End If
- TmpServer$ = MainForm.List1.List(List1.ListIndex)
- For i% = 1 To 8
- If TmpServer$ = MainForm.List2.List(i% - 1) Then
- Txt$ = "You are already attached to "
- Txt$ = Txt$ + "this server. You must detach in "
- Txt$ = Txt$ + "order to re-attach!"
- MsgBox Txt$, 32, "Already Attached"
- Exit Sub
- End If
- Next i%
- ' ================================
- ' Check to see if at least 1 of the 8 slots is empty
- CanAdd% = False
- For i% = 1 To 8
- If FileServerNames$(i%) = "" Then
- CanAdd% = True
- Exit For
- End If
- Next i%
-
- If CanAdd% = False Then
- Txt$ = "All 8 slots for attaching to "
- Txt$ = Txt$ + "file servers are filled. You "
- Txt$ = Txt$ + "must de-attached from one of "
- Txt$ = Txt$ + "before attaching to another "
- Txt$ = Txt$ + "server!"
- MsgBox Txt$, 32, "All Slots Filled"
- Exit Sub
- End If
- ' ================================
- ' Clear all 3 list boxes
- ClearListBox List1
- ClearListBox List2
- ClearListBox List3
- MainForm.Hidden1.Text = ""
- MainForm.Hidden2.Text = ""
- Password.Show 1
- Unload Password
- If MainForm.Hidden1.Text <> "***VOID***" Then
- TempUserID$ = Hidden1.Text
- UserPass$ = Hidden2.Text
- Logon TmpServer$, TempUserID$, UserPass$
- End If
- UserID$ = MainForm.Text2.Text
- FillOutLists UserID$
- End Sub
- Sub Command2_Click ()
- ' ================================
- ' First check to see if attached and if item is marked in List2
- ' Also, NEVER detach from Primary Server (#1 in list)
- If MainForm.List2.ListIndex = -1 Then
- Txt$ = "You must first select a server "
- Txt$ = Txt$ + "to detach From!"
- MsgBox Txt$, 32, "Must Pick Server"
- Exit Sub
- End If
- TmpServer$ = MainForm.List2.List(List2.ListIndex)
- TmpTxt$ = Text1.Text
- If TmpServer$ = AllTrim(TmpTxt$) Then
- Txt$ = "You cannot detach from your "
- Txt$ = Txt$ + "Primary server!"
- MsgBox Txt$, 32, "Critical Problem"
- Exit Sub
- End If
- ' ================================
- ' Clear all 3 list boxes
- ClearListBox List1
- ClearListBox List2
- ClearListBox List3
- Logoff TmpServer$
- UserID$ = MainForm.Text2.Text
- FillOutLists UserID$
- End Sub
- Sub Command3_Click ()
- Map_Drv.Show 1
- Unload Map_Drv
- End Sub
- Sub FillOutLists (UserID$)
- ClearListBox List1
- ClearListBox List2
- ClearListBox List3
- ' ======================================================
- ' Get array of up to 255 servers that are available, and
- ' display them in List1
- GetAllServers
- For i% = 1 To UBound(WorkingServers$)
- MainForm.List1.AddItem WorkingServers$(i%)
- Next i%
- ' ======================================================
- ' Get array of up to 8 servers you can be attached to,
- ' and display them in List2 in their ordinal order 1 - 8
- GetServerName FileServerNames$()
- For i% = 1 To 8
- If Len(FileServerNames$(i%)) > 0 Then
- MainForm.List2.AddItem FileServerNames$(i%)
- Else
- MainForm.List2.AddItem "-- not attached --"
- End If
- Next i%
- ' ======================================================
- ' Get the userID on each of the 8 servers you are attached
- ' to, and display them in List3
- MainForm.List3.AddItem UserID$
- For i% = 2 To 8
- If List2.List(i% - 1) <> "-- not attached --" Then
- ConnectID% = i%
- GetUser ConnectID%, TempUserID$
- MainForm.List3.AddItem TempUserID$
- Else
- MainForm.List3.AddItem "-- N/A --"
- End If
- Next i%
- End Sub
- Sub Form_Load ()
- CrLf$ = Chr$(13) + Chr$(10) ' Since it is global, this
- ' sets it for the program
- MainForm.Show
- MainForm.MousePointer = 11 ' #11 = hourglass
- Form_Paint
- ' ======================================================
- ' Check to see if on a network, abort if not
- CheckNet NetWork%
- If NetWork% = False Then
- Msg$ = "You must be running on a Novell Network in order"
- Msg$ = Msg$ + " to run this program...."
- MsgBox Msg$, 48, "Aborting Program"
- Unload MainForm
- End If
-
- GetNovellParms CDate$, CTime$, UserID$ ' Get user info
- MainForm.Text2.Text = UserID$
- Text3.Text = CDate$
- Text4.Text = CTime$
- ' ======================================================
- ' Check to see if got current version of all DLL's
- If NetWork% = True Then
- Suc% = False
- GetNovellVer Suc%
- If Suc% = False Then
- Unload MainForm
- End If
- End If
- ' ======================================================
- ' Check to see if another copy of program is loaded, and
- ' abort if it is -- optional, but good defensive programming
- ' in many cases
- hwd% = GetModuleHandle("Example.exe")
- If GetModuleUsage(hwd%) > 1 Then
- Msg$ = "Another copy of Example is loaded."
- Msg$ = Msg$ + " Only one copy of this program can run at one time."
- Msg$ = Msg$ + Chr$(13) + Chr$(10) + Chr$(13) + Chr$(10)
- Msg$ = Msg$ + "Abort loading this copy of Example!"
- MsgBox Msg$, 48, "Another copy of program loaded!"
- Unload MainForm
- End If
- ' ======================================================
- ' Fill out lists 1 - 3
- FillOutLists UserID$
- ' ======================================================
- ' Put the default server name in text box
- Text1.Text = AllTrim(FileServerNames$(1))
- ' ======================================================
- ' Set mouse pointer back to arrow
- Screen.MousePointer = 1
- End Sub
- Sub Form_Paint ()
- Command1.Left = List1.Left + ((List1.Width - Command1.Width) \ 2)
- Command2.Left = List2.Left + ((List2.Width - Command2.Width) \ 2)
- Text1.Left = List1.Left
- Text2.Left = List1.Left
- MainForm.CurrentX = MainForm.List1.Left
- MainForm.CurrentY = MainForm.List1.Top - 400
- MainForm.Print "Available Servers:"
- MainForm.CurrentX = MainForm.List2.Left
- MainForm.CurrentY = MainForm.List2.Top - 400
- MainForm.Print "Attached Servers:"
- tempStr$ = "User ID:"
- MainForm.CurrentX = MainForm.List3.Left + ((List3.Width - TextWidth(tempStr$)) \ 2)
- MainForm.CurrentY = MainForm.List3.Top - 400
- MainForm.Print tempStr$
- MainForm.CurrentX = MainForm.Text1.Left
- MainForm.CurrentY = MainForm.Text1.Top - 400
- MainForm.Print "Primary Server:"
- MainForm.CurrentX = MainForm.Text2.Left
- MainForm.CurrentY = MainForm.Text2.Top - 400
- MainForm.Print "User ID, Primary Server:"
- MainForm.CurrentX = MainForm.Text3.Left
- MainForm.CurrentY = MainForm.Text3.Top - 400
- MainForm.Print "Login Date:"
- MainForm.CurrentX = MainForm.Text4.Left
- MainForm.CurrentY = MainForm.Text4.Top - 400
- MainForm.Print "Login Time:"
- End Sub
- Sub Form_Unload (Cancel As Integer)
- End
- End Sub
-