Platform SDK: Broadcast Architecture

BPCSuspend

The BPCSuspend class contains a single method, DeviceRelease. Your application can use DeviceRelease to suspend the Video Access server and cause it to release all devices for use by other applications. For more information on this process, see Suspending the Video Access Server.

Remarks

Your application should not use the BPCSuspend or BPCSuspended class while it is in a state in which cross-process COM calls are disallowed. For example, if your application is currently processing a call to the Microsoft® Win32® SendMessage function or a broadcast system message any cross-process COM calls fail with an RPC_E_CANTCALLOUT_ININPUTSYNCCALL error code. If your application is in such a state when it attempts to suspend the Video Access server, the running object table can become corrupt and lock up the server.

Requirements

  Windows NT/2000: Unsupported.
  Windows 95/98: Requires Windows 98.
  Header: Declared in vidsvr.odl.
  Import Library: Included as a resource in vid.ocx.

See Also

BPCSuspended

Examples

The following example uses a BPCSuspend object to request that the Video Access server release all devices. When the devices are no longer needed, the BPCSuspended object is set to Nothing, allowing the Video Access server to reconnect to the devices. The BPCSuspended object indicates whether the Video Access server has released all video devices. If it exists, the Video Access server is suspended and has released all video devices. If it does not exist, the suspend request failed.

Note  For the following code to work, the Video Access server (Vidsvr.exe) must be running and you must add the following keys to the registry:

HKEY_CLASSES_ROOT\MS BPC Video Server Suspend

HKEY_CLASSES_ROOT\MS BPC Video Server Suspend\CLSID
      "{887072E7-45D6-11D1-B6B0-00C04FBBDE6E}"

Private Sub BPCSuspend()
    Dim susp As BPCSuspend
    Dim suspended As BPCSuspended
    
    On Error GoTo ErrorHandler
    Set susp = GetObject(, "MS BPC Video Server Suspend")
    On Error Goto 0
    If (susp Is Nothing) Then
        MsgBox "Video Access server is not running."
    Else
        On Error Goto ErrorHandler2
        susp.DeviceRelease 0, suspended
        On Error Goto 0
        If (suspended Is Nothing) Then
            MsgBox "Video Access server is active, won't suspend."
        Else
            MsgBox "DeviceRelease() succeeded. Video Access server suspended."
            Set suspended = Nothing
        End If
        Set susp = Nothing
    End If
    Exit Sub
    
ErrorHandler:
    If (Err.Number = 429) Then
        MsgBox "Video Access server is not running."
    Else
        MsgBox "Error " + Str(Err.Number)
    End If
    Goto Exit_BPCSuspend
 
ErrorHandler2:
    If (Err.Number = -2147467259) Then
        MsgBox "Video Access server is active, won't suspend."
    Else
        MsgBox "Error " + Str(Err.Number)
    End If
 
Exit_BPCSuspend:    
    
End Sub