home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form SyncForm Caption = "Synchronization Services Test" ClientHeight = 2640 ClientLeft = 1095 ClientTop = 1485 ClientWidth = 6705 Height = 3045 Left = 1035 LinkTopic = "Form1" ScaleHeight = 2640 ScaleWidth = 6705 Top = 1140 Width = 6825 Begin Timer SyncTimer Interval = 1000 Left = 360 Top = 1680 End Begin CommandButton CancelButton Caption = "&Cancel" Height = 495 Left = 2640 TabIndex = 0 Top = 2040 Width = 1095 End Begin Label Label2 Caption = "Run NWTEST at least 4 times (on this or multiple workstations) and select ""Synchronization"" from the Test menu. The current user count will be updated every second." Height = 615 Left = 120 TabIndex = 3 Top = 720 Width = 6375 End Begin Label Label1 Caption = "Scenario: There is a resource on the network (a program, for example) that you want to restrict to 3 simultaneous users." Height = 495 Left = 120 TabIndex = 2 Top = 120 Width = 6495 End Begin Label CountLabel Height = 255 Left = 1800 TabIndex = 1 Top = 1560 Width = 2895 End Dim semaHandle& Const SEMA_VALUE = 3 Dim exiting% Sub CancelButton_Click () Unload SyncForm End Sub Sub Form_Load () exiting% = False ccode% = OpenSemaphore("VB_SYNCH_EXAMPLE", SEMA_VALUE, semaHandle&, openCount%) If (ccode% <> SUCCESSFUL) Then MsgBox "Unable to open semaphore", MB_OK, "Error" Unload SyncForm End If If (openCount% > SEMA_VALUE) Then MsgBox "Unable to add another user. Network resource is already in use by " + Str$(openCount% - 1) + " users", MB_OK, "Warning" exiting% = True Else CountLabel.Caption = "Current user count = " + Str$(openCount%) End If End Sub Sub Form_Unload (Cancel As Integer) ccode% = CloseSemaphore(semaHandle&) End Sub Sub SyncTimer_Timer () If (exiting%) Then Unload SyncForm Else ccode% = ExamineSemaphore(semaHandle&, SEMA_VALUE, openCount%) If (ccode% <> SUCCESSFUL) Then MsgBox "Unable to examine semaphore value.", MB_OK, "Error" End If CountLabel.Caption = "Current user count = " + Str$(openCount%) End If End Sub Sub Timer1_Timer () End Sub