summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2006-05-31 12:01:00 +0200
committerMartin Burnicki <martin.burnicki@meinberg.de>2006-05-31 12:01:00 +0200
commit95e8386fc771aea71e2b36a13ef439a6f7dd8414 (patch)
treed247e432b3fcf322fb491f2ed8e0ea9b4ea6a9a7
parentfa2ee4420e822ddc714e2e106bb24e7cd16e2920 (diff)
downloadmbgsdk-win-95e8386fc771aea71e2b36a13ef439a6f7dd8414.tar.gz
mbgsdk-win-95e8386fc771aea71e2b36a13ef439a6f7dd8414.zip
Update unit mbgdevio-vb6 and the example codembgdevio-demo-vb6-2.12
-rw-r--r--common/mbgdevio-vb6.bas142
-rw-r--r--mbgdevio-demo-vb6.exebin20480 -> 32768 bytes
-rw-r--r--mbgdevio-demo-vb6.frm385
-rw-r--r--mbgdevio-demo-vb6.vbp14
4 files changed, 454 insertions, 87 deletions
diff --git a/common/mbgdevio-vb6.bas b/common/mbgdevio-vb6.bas
index f5f07b3..48ac7c3 100644
--- a/common/mbgdevio-vb6.bas
+++ b/common/mbgdevio-vb6.bas
@@ -2,7 +2,7 @@ Attribute VB_Name = "mbgdevio"
'**************************************************************************
'
-' $Id: mbgdevio.bas 1.2 2004/02/25 11:14:47Z martin TEST $
+' $Id: mbgdevio-vb6.bas 1.3 2006/05/31 13:27:29Z martin REL_M $
'
' Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
'
@@ -10,11 +10,19 @@ Attribute VB_Name = "mbgdevio"
' Types and function declarations used to access Meinberg radio clock
' devices using the mbgdevio DLL from Visual Basic.
'
+' This module is for Visual Basic 6 which provides only limited support
+' for complex data types.
+'
' If there are any questions or enhancemetnt requests, please contact
' Meinberg: support@meinberg.de
'
' -----------------------------------------------------------------------
-' $Log: mbgdevio.bas $
+' $Log: mbgdevio-vb6.bas $
+' Revision 1.3 2006/05/31 13:27:29Z martin
+' Added declarations used to deal with HR time.
+' Added declarations to deal with user capture events.
+' Renamed this file to mbgdevio-vb6.bas since it is not compatible
+' with VB.NET.
' Revision 1.2 2004/02/25 11:14:47Z martin
' Added definitions of the PCPS_TIME status bits.
' Revision 1.1 2004/02/23 11:19:45Z martin
@@ -46,7 +54,54 @@ Public Type PCPS_TIME
End Type
-' Flag bits used with the pcps_time.status field:
+' The structure below has been introduced to be able to handle
+' high resolution time stamps.
+
+Public Type PCPS_TIME_STAMP
+ sec As Long ' UInt32, seconds since 1970 (UTC)
+ frac As Long ' UInt32, fractions of second ( &HFFFFFFFF == 0.9999.. sec)
+End Type
+
+
+' The structure below holds a HR time stamp, plus UTC offset and status info
+
+Public Type PCPS_HR_TIME
+ tstamp As PCPS_TIME_STAMP
+ utc_offs As Long ' [sec] signed!! (local time = tstamp + offs_utc)
+ status As Integer ' flag bits, see below
+ signal As Byte ' 0..255
+End Type
+
+
+
+' The structure below holds a HR time plus an associated Windows
+' performance counter value which can be used to relate performance
+' counter values to the current time. Please note that an application
+' must also determine the Windows performance counter frequency in order
+' to convert differences of performance counter values to time intervals.
+
+Public Type LongLong
+ lo As Long
+ hi As Long
+End Type
+
+Public Type PCPS_HR_TIME_CYCLES
+ cycles As LongLong ' UInt64, performance counter value
+ t As PCPS_HR_TIME ' associated HR time
+End Type
+
+
+' The structure below contains the maximum number of entries of an on-board
+' user capture FIFO buffer plus the number of currently used entries.
+
+Public Type PCPS_UCAP_ENTRIES
+ used As Long ' the number of saved capture events
+ max As Long ' capture buffer size
+End Type
+
+
+' Bit masks used with both the status fields of the PCPS_TIME structure
+' and the PCPS_HR_TIME structure:
Public Const PCPS_FREER = &H1 ' DCF77 clock running on xtal
' GPS receiver has not verified its position
@@ -66,11 +121,35 @@ Public Const PCPS_IFTM = &H40 ' the current time was set via PC interface
Public Const PCPS_INVT = &H80 ' invalid time because battery was disconnected
+' Bit masks used with the status fields of the PCPS_HR_TIME structure only:
+
+Public Const PCPS_LS_ENB = &H100 ' current second is leap second
+Public Const PCPS_ANT_FAIL = &H200 ' antenna failure
+
+
+' The next two status bits are used only if the PCPS_HR_TIME structure
+' PCPS_HR_TIME contains a user capture event:
+
+Public Const PCPS_UCAP_OVERRUN = &H2000 ' events interval too short
+Public Const PCPS_UCAP_BUFFER_FULL = &H4000 ' events read too slow
+
+
+
'
' Some of the functions exported by the mbgdevio DLL
' --------------------------------------------------
'
+' GENERAL NOTE:
+' Not all API calls described below are supported by any Meinberg
+' plug-in card. Calls to functions which are not supported by a device
+' don't do any harm, they just return an error code to the application.
+' However, every API call to an unsupported function results in a log entry
+' in the Windows application event log, so an application should first check
+' whether such an API call is supported by the specific device. API calls
+' which are not supported by each device are commented accordingly.
+
+
' Return the number of radio clock devices detected
' If this function returns 0, then no devices has been detected.
Public Declare Function mbg_find_devices Lib "mbgdevio" () As Long
@@ -83,6 +162,63 @@ Public Declare Function mbg_open_device Lib "mbgdevio" (ByVal i As Long) As Long
' The device handle value will be set to 0.
Public Declare Function mbg_close_device Lib "mbgdevio" (ByRef h As Long) As Long
+
+'--------------------------------------------------------------------------------
' Read date, time, and status from the device referenced by handle h.
+' This function is supported by all Meinberg plug-in boards and returns
+' date and time in human readable format (calendar date and time).
+' However, the resolution of time is limited to 10 milliseconds.
Public Declare Function mbg_get_time Lib "mbgdevio" (ByVal h As Long, ByRef t As PCPS_TIME) As Long
+
+'--------------------------------------------------------------------------------
+' The functions below read high resolution time plus status from the device
+' referenced by handle h.
+' These functions are NOT supported by all Meinberg plug-in boards, and the
+' effective resolution of the HR time depends on the characteristics of the
+' specific device.
+
+' Check whether the device referenced by handle h supports HR time.
+' If it does then the value returned for f is not 0.
+Public Declare Function mbg_dev_has_hr_time Lib "mbgdevio" (ByVal h As Long, ByRef f As Long) As Long
+
+' Read a HR time stamp from the board. The returned time stamp may be biased
+' by a latency due to the IOCTL call performed by the function.
+Public Declare Function mbg_get_hr_time Lib "mbgdevio" (ByVal h As Long, ByRef t As PCPS_HR_TIME) As Long
+
+' Read a HR time stamp from the board plus a performance counter value
+' associated to that time stamp. The performance counter value can be used
+' by the application to compensate the latency mentioned above.
+Public Declare Function mbg_get_hr_time_cycles Lib "mbgdevio" (ByVal h As Long, ByRef p As PCPS_HR_TIME_CYCLES) As Long
+
+' Read a HR time stamp from the board and compensate the latency. Return the compensated
+' time stamp, and optionally also return the latency value in 100 nanosecond units.
+' If the application does not need the latency value then a null pointer may be passed
+' for parameter l.
+Public Declare Function mbg_get_hr_time_comp Lib "mbgdevio" (ByVal h As Long, ByRef t As PCPS_HR_TIME, ByRef l As Long) As Long
+
+
+'--------------------------------------------------------------------------------
+' The functions below can be used with the capture buffer available on some cards.
+' These functions are NOT supported by all Meinberg plug-in boards, and the
+' effective accuracy of the time capture events depends on the characteristics
+' of the specific device.
+
+' Check whether the device referenced by handle h provides support for
+' user capture events.
+' If it does then the value returned for f is not 0.
+Public Declare Function mbg_dev_has_ucap Lib "mbgdevio" (ByVal h As Long, ByRef f As Long) As Long
+
+' Clear the on-board user capture FIFO buffer
+Public Declare Function mbg_clr_ucap_buff Lib "mbgdevio" (ByVal h As Long) As Long
+
+' Retrieve the maximum number of events that can be stored in the on-board
+' FIFO buffer, and the number of events currently saved in the buffer.
+Public Declare Function mbg_get_ucap_entries Lib "mbgdevio" (ByVal h As Long, ByRef p As PCPS_UCAP_ENTRIES) As Long
+
+' Retrieve an entry from the on-board user capture FIFO buffer. The returned entry
+' is removed from the buffer. If no event is available in the buffer, i.e. the buffer
+' is empty, then then both the seconds and fractions of the returned time stamp are 0.
+Public Declare Function mbg_get_ucap_event Lib "mbgdevio" (ByVal h As Long, ByRef t As PCPS_HR_TIME) As Long
+
+
diff --git a/mbgdevio-demo-vb6.exe b/mbgdevio-demo-vb6.exe
index 130761e..babd669 100644
--- a/mbgdevio-demo-vb6.exe
+++ b/mbgdevio-demo-vb6.exe
Binary files differ
diff --git a/mbgdevio-demo-vb6.frm b/mbgdevio-demo-vb6.frm
index adeca2f..a3b3ad1 100644
--- a/mbgdevio-demo-vb6.frm
+++ b/mbgdevio-demo-vb6.frm
@@ -1,32 +1,33 @@
VERSION 5.00
-Begin VB.Form mbgdemo
+Begin VB.Form mbgdevio_demo_vb6
Caption = "Check Radio Clock Sync Status"
- ClientHeight = 1680
+ ClientHeight = 4620
ClientLeft = 60
ClientTop = 345
- ClientWidth = 4680
+ ClientWidth = 6495
LinkTopic = "Form1"
- ScaleHeight = 1680
- ScaleWidth = 4680
+ ScaleHeight = 4620
+ ScaleWidth = 6495
StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
+ Begin VB.CommandButton UpdateCommandButton
Caption = "Update"
Height = 495
- Left = 1320
+ Left = 2280
TabIndex = 1
- Top = 960
+ Top = 3960
Width = 1935
End
- Begin VB.TextBox Text1
- Height = 495
+ Begin VB.TextBox InfoTextBox
+ Height = 3495
Left = 240
+ MultiLine = -1 'True
TabIndex = 0
- Text = "Press ""Update"" to check."
+ Text = "mbgdevio-demo-vb6.frx":0000
Top = 240
- Width = 4215
+ Width = 6015
End
End
-Attribute VB_Name = "mbgdemo"
+Attribute VB_Name = "mbgdevio_demo_vb6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
@@ -34,117 +35,347 @@ Attribute VB_Exposed = False
'**************************************************************************
'
-' $Id: mbgdemo.frm 1.2 2004/02/25 11:15:37Z martin TEST $
+' $Id: mbgdevio-demo-vb6.frm 1.3 2006/05/31 14:03:04Z martin REL_M $
'
' Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
'
' Description:
-' Sample Visual Basic code demonstrating howto access
-' Meinberg radio clock devices using the mbgdevio.bas module
+' Sample Visual Basic code demonstrating how to access
+' Meinberg radio clock devices using the mbgdevio module
' which contains the interface to the mbgdevio DLL shipped with
' the driver software package.
'
-' The module mbgdevio.bas must be added to the project.
-' By default, the module is located in the subdirectory "common\".
+' The module mbgdevio must be added to the project. By default,
+' the module is located in the subdirectory "common\".
+'
+' This sample code is for Visual Basic 6 which provides only limited
+' support for complex data types.
'
-' If there are any questions or enhancemetnt requests, please contact
+' If there are any questions or enhancement requests, please contact
' Meinberg: support@meinberg.de
'
' -----------------------------------------------------------------------
-' $Log: mbgdemo.frm $
+' $Log: mbgdevio-demo-vb6.frm $
+' Revision 1.3 2006/05/31 14:03:04Z martin
+' Also read and display HR time, and user capture events.
+' Renamed project and form.
' Revision 1.2 2004/02/25 11:15:37Z martin
' Added standard file header, and some comments.
'
'**************************************************************************
-' The function below tries to read the status of a device.
-' If returned value is negative then an error has occurred.
-' If the return value is not negative then the 8 LSBs of
-' the return value contain the bit coded status.
+' The function below takes a device status value and
+' returns a string which indicates whether the device
+' is synchronized, or not.
+
+Private Function MbgSyncStatusStr(status As Integer)
+
+ ' If the PCPS_FREER bit is set in the status
+ ' then the device is not synchronized
+ If status And PCPS_FREER Then
+ MbgSyncStatusStr = "NOT synchronized"
+ Else
+ MbgSyncStatusStr = "synchronized"
+ End If
+
+End Function
+
+
+
+' The function below takes a PCPS_TIME structure and returns
+' a string which represents the date and time from that structure.
+
+Private Function PcpsTimeToString(t As PCPS_TIME) As String
+
+ Dim LongYear As Integer
+ Dim offs_utc As Integer
+
+ ' Convert 2 digit year number to 4 digit year
+ If t.year < 90 Then
+ LongYear = t.year + 2000
+ Else
+ LongYear = t.year + 1900
+ End If
+
+ ' Negative UTC offset values require special handling since VB6 only
+ ' provides unsigned 8 bit values whereas the t.offs_utc value's nature
+ ' is signed.
+
+ If t.offs_utc > 127 Then
+ offs_utc = 256 - t.offs_utc
+ c = "-"
+ Else
+ offs_utc = t.offs_utc
+ c = "+"
+ End If
+
+ PcpsTimeToString = Format(LongYear, "000#") + "-" _
+ + Format(t.month, "0#") + "-" _
+ + Format(t.mday, "0#") + " " _
+ + Format(t.hour, "0#") + ":" _
+ + Format(t.min, "0#") + ":" _
+ + Format(t.sec, "0#") + "." _
+ + Format(t.sec100, "0#") + " UTC" _
+ + c + Format(offs_utc) + "h"
+End Function
+
+
+
+' The function below takes a PCPS_TIME_STAMP structure and returns
+' a string of seconds and fractions represented as hex numbers
+
+Private Function PcpsTimeStampToHexString(t As PCPS_TIME_STAMP) As String
-Private Function mbg_get_device_status() As Long
+ PcpsTimeStampToHexString = Format(Hex(t.sec), "00000000") + "." _
+ + Format(Hex(t.frac), "00000000")
+End Function
- Dim h As Long
- Dim rc As Long
+
+
+' The function below takes a PCPS_TIME_STAMP structure and returns
+' a string which represents the date and time.
+
+Private Function PcpsTimeStampToString(t As PCPS_TIME_STAMP) As String
+
+ Const DaysPerYear As Double = 86400#
+ Const EpocheOffs1970 As Double = 25569#
+ Const frac_scale As Double = 4294967296# ' &H100000000
+ Dim dt As Date
+ Dim frac As Double
+
+ ' Convert seconds since 1970 to the VB date format
+ dt = CDate(CDbl(t.sec) / DaysPerYear + EpocheOffs1970)
+
+ ' Convert the fractions of the second to decimal fractions
+ ' (&HFFFFFFFF = 0.999999...)
+ frac = CDbl(t.frac)
+
+ ' Negative frac values require special handling since VB6 only
+ ' provides signed 32 bit values whereas the frac value's nature
+ ' is unsigned
+ If t.frac < 0 Then
+ frac = frac + frac_scale
+ End If
+
+ frac = frac / frac_scale
+
+ ' Re-scale the fractions depending on the number of decimal
+ ' digits we want to print, e.g. if we want to print 7 digits
+ ' (100 nanosecond units) then we must multiply by 1E7
+ ' and specify the format string accordingly.
+ frac = frac * 10000000#
+
+ PcpsTimeStampToString = Format(dt, "yyyy-mm-dd hh:MM:ss") + "." _
+ + Format(frac, "0000000")
+End Function
+
+
+
+' The function below takes a PCPS_HR_TIME structure and returns
+' a string representing the UTC time.
+
+Private Function PcpsHrTimeToUtcTimeString(ht As PCPS_HR_TIME) As String
+
+ PcpsHrTimeToUtcTimeString = PcpsTimeStampToString(ht.tstamp) + " UTC"
+
+End Function
+
+
+
+' The function below takes a PCPS_HR_TIME structure and returns
+' a string representing the local time according to the time zone offset
+' which in turn depends on the time zone configuration of the board.
+
+Private Function PcpsHrTimeToLocalTimeString(ht As PCPS_HR_TIME) As String
+
+ Dim tmp_ht As PCPS_HR_TIME
+ Dim hours As Integer
+ Dim Mins As Integer
+ Dim c As String
+
+ ' Add the UTC offset to the seconds field in order to yield local time
+ ' according to the time zone configuration on the board.
+ tmp_ht = ht
+ tmp_ht.tstamp.sec = tmp_ht.tstamp.sec + tmp_ht.utc_offs
+
+ ' Save the sign of the offset and make sure the value is not negative
+ If tmp_ht.utc_offs < 0 Then
+ c = "-"
+ tmp_ht.utc_offs = -tmp_ht.utc_offs
+ Else
+ c = "+"
+ End If
+
+ ' Convert the UTC offset which is in seconds to hours and minutes
+ Mins = tmp_ht.utc_offs / 60 ' now we have total minutes
+ hours = Mins / 60 ' determine the number of hours
+ Mins = Mins - hours * 60 ' determine remaining minutes
+
+ PcpsHrTimeToLocalTimeString = PcpsTimeStampToString(tmp_ht.tstamp) _
+ + " UTC" + c + Format(hours, "0#") _
+ + ":" + Format(Mins, "0#") + "h"
+
+End Function
+
+
+
+' The subroutine below is executed whenever the "Update" button is clicked.
+' It opens the device, read and display some information, and finally
+' closes the device.
+
+Private Sub UpdateCommandButton_Click()
+
+ Dim n As Integer ' number of devices found
+ Dim h As Long ' device handle
+ Dim rc As Long ' return code from API functions
Dim currTime As PCPS_TIME
- Dim n As Integer
+ Dim f As Long ' flag
+ ' Find how how many devices are installed
n = mbg_find_devices
If n = 0 Then
- mbg_get_device_status = -1 ' No device found.
- Exit Function
+ Me.InfoTextBox.Text = "No device found."
+ Exit Sub
End If
- ' Always first device (index 0), even if more devices have been found
+ ' Always use first device (index 0), even if more devices
+ ' have been found
h = mbg_open_device(0)
- If h = -1 Then ' -1 means INVALID_HANDLE_VALUE (Win API)
- mbg_get_device_status = -2 ' Unable to open device
- Exit Function
+ If h = -1 Then ' -1 means INVALID_HANDLE_VALUE (Win API)
+ Me.InfoTextBox.Text = "Unable to open device."
+ Exit Sub
End If
+ ' Read the current time and status
rc = mbg_get_time(h, currTime)
- mbg_close_device (h)
-
If rc <> 0 Then
- mbg_get_device_status = -3 ' Error accessing the device
- Exit Function
+ Me.InfoTextBox.Text = "Error accessing the device."
+ GoTo done
End If
-
- mbg_get_device_status = currTime.status ' Return the valid status
+ If currTime.year < 90 Then
+ LongYear = currTime.year + 2000
+ Else
+ LongYear = currTime.year + 1900
+ End If
-End Function ' mbg_get_device_status
-
-
-
-' The function below tries to read the status of a device
-' and check if the status is 'synchronized'
-' If the return value is negative then an error has occurred.
-' If the clock is synchronized then the return value is 1,
-' otherwise the function returns 0.
-
-Private Function mbg_device_is_synchronized() As Long
-
- Dim status As Long
-
- status = mbg_get_device_status
+ Me.InfoTextBox.Text = "Current local time" + " (" _
+ + MbgSyncStatusStr(CInt(currTime.status)) + "):" + Chr(13) + Chr(10)
- If status < 0 Then
- mbg_device_is_synchronized = status ' Sync status could not be retrieved
- Exit Function
- End If
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + PcpsTimeToString(currTime) + Chr(13) + Chr(10)
- If status And PCPS_FREER Then ' If PCPS_FREER bit is set
- mbg_device_is_synchronized = 0 ' then the device is not synchronized
+ ' If the device supports HR time, also read the HR time
+ rc = mbg_dev_has_hr_time(h, f)
+
+ If rc = PCPS_SUCCESS Then
+ ' could check successfully
+ If f <> 0 Then
+ ' device supports HR time
+ Dim ht As PCPS_HR_TIME
+
+ rc = mbg_get_hr_time(h, ht)
+
+ If rc = PCPS_SUCCESS Then
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + Chr(13) + Chr(10) _
+ + "HR time " + " (" _
+ + MbgSyncStatusStr(ht.status) + "):" + Chr(13) + Chr(10) _
+ + PcpsHrTimeToUtcTimeString(ht) + Chr(13) + Chr(10) _
+ + PcpsHrTimeToLocalTimeString(ht) + Chr(13) + Chr(10) _
+ + "Raw: " + PcpsTimeStampToHexString(ht.tstamp)
+ Else
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Error reading HR time."
+ End If
+ Else
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Device does not support HR time."
+ End If
Else
- mbg_device_is_synchronized = 1 ' otherwise it is synchronized
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Error checking if device supports HR time."
End If
-
-End Function ' mbg_device_is_synchronized
+
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + Chr(13) + Chr(10) + Chr(13) + Chr(10)
+
+
+ ' If the device supports user capture inputs, also display user capture info
+ rc = mbg_dev_has_ucap(h, f)
+
+ If rc = PCPS_SUCCESS Then
+ ' could check successfully
+ If f <> 0 Then
+ ' device supports user captures
+ Dim ucap_entries As PCPS_UCAP_ENTRIES
+ Dim ucap As PCPS_HR_TIME
+
+ rc = mbg_get_ucap_entries(h, ucap_entries)
+
+ If rc = PCPS_SUCCESS Then
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Ucap Entries: " _
+ + Format(ucap_entries.used, "0") + "/" _
+ + Format(ucap_entries.max, "0") + " used" + Chr(13) + Chr(10)
+ Else
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Error reading ucap entries."
+ End If
+
+ ' Though it's only useful to read a capture event if ucap_entries.used
+ ' is not 0, we do it anyway. If there's no entry in the user capture
+ ' buffer then the returned time stamp will be 0.
+ rc = mbg_get_ucap_event(h, ucap)
+
+ If rc = PCPS_SUCCESS Then
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + "Ucap read: Raw: " + PcpsTimeStampToHexString(ucap.tstamp) + Chr(13) + Chr(10)
+
+ If ucap.tstamp.sec = 0 And ucap.tstamp.frac = 0 Then
+ ' No capture event has been available in the buffer
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + "(No ucap event available)"
+ Else
+ ' Print the user capture input channel number and the time stamp.
+ ' Any of the PcpsHrTime.. or PcpsTimeStamp.. functions could be
+ ' used here to print the time stamp.
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + "Ch" + Format(ucap.signal) + ": " _
+ + PcpsHrTimeToLocalTimeString(ucap)
+ ' Check the ucap event status to see if an overrun has occurred
+ ' (i.e. the interval between 2 events has been too short)
+ If ucap.status And PCPS_UCAP_OVERRUN Then
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + " << OVR"
+ End If
-' The subroutine below is executed whenever the "Update" button is clicked.
+ ' Check the ucap event status to see if a buffer overflow has
+ ' occurred (i.e. more events have occurred than could be stored
+ ' in the FIF buffer)
+ If ucap.status And PCPS_UCAP_BUFFER_FULL Then
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text _
+ + " << FULL"
+ End If
-Private Sub Command1_Click()
- Dim isSynchronized As Long
-
- isSynchronized = mbg_device_is_synchronized
-
- If isSynchronized < 0 Then
- Me.Text1.Text = "Sync Status could not be read."
- Else
- If isSynchronized > 0 Then
- Me.Text1.Text = "Device is synchronized."
+ End If
+ Else
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Error reading ucap entries."
+ End If
Else
- Me.Text1.Text = "Device is NOT synchronized."
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Device does not support user captures."
End If
+ Else
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + "Error checking if device supports user captures."
End If
-
+
+ Me.InfoTextBox.Text = Me.InfoTextBox.Text + Chr(13) + Chr(10)
+
+
+done:
+ mbg_close_device (h)
+
End Sub
+
diff --git a/mbgdevio-demo-vb6.vbp b/mbgdevio-demo-vb6.vbp
index 28faef6..385751d 100644
--- a/mbgdevio-demo-vb6.vbp
+++ b/mbgdevio-demo-vb6.vbp
@@ -1,14 +1,14 @@
Type=Exe
-Form=mbgdemo.frm
-Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation
-Module=mbgdevio; common\mbgdevio.bas
-IconForm="mbgdemo"
-Startup="mbgdemo"
+Form=mbgdevio-demo-vb6.frm
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINNT\system32\stdole2.tlb#OLE Automation
+Module=mbgdevio; common\mbgdevio-vb6.bas
+IconForm="mbgdevio_demo_vb6"
+Startup="mbgdevio_demo_vb6"
HelpFile=""
Title="Project1"
-ExeName32="mbgdemo.exe"
+ExeName32="mbgdevio-demo-vb6.exe"
Command32=""
-Name="Project1"
+Name="mbgdevio_demo"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1