Share via


PosCommon.Claim Method

Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)

Usage

'Usage
Dim timeout As Integer
Dim posCommon1 As PosCommon
posCommon1.Claim(timeout)

Syntax

'Declaration
Public MustOverride Sub Claim( _
    ByVal timeout As Integer _
)
public abstract void Claim(
    int timeout
);
public: abstract Void Claim(
    Int32 timeout
);
public abstract void Claim(
    int timeout
);
public abstract function Claim(
     timeout : int
) : Void;

Parameters

  • timeout
    Contains the maximum number of milliseconds to wait for exclusive access to be satisfied.

Remarks

The application calls Claim to request exclusive access to the device. Many devices require an application to claim them before they can be used.

If the timeout parameter indicates the maximum amount of time in milliseconds that the service object should wait for exclusive access to be granted. If timeout is set to 0 (zero), the method attempts to claim the device, then returns the appropriate status immediately. If timeout is set to WaitForever (-1), Claim waits as long as needed for exclusive access to be satisfied.

An application can claim a device more than once without generating an error. When Claim is successful, POS for .NET sets the Claimed property to TRUE and loads the appropriate statistics counters and device information.

All base and basic class implementations of Claim use a system-wide name Mutex object to provide exclusive access to the device. The name of the Mutex object is derived from a combination of the DeviceName, DevicePath and device type.

Claim can also throw the following exceptions:

Value

Meaning

Illegal

One of the following conditions has occurred:

  • The device cannot currently be claimed for exclusive access; or

  • A value of less than -1 has been specified for the timeout parameter.

Timeout

Another application has exclusive access to the device and did not relinquish control before timeout milliseconds expired.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

See Also

Reference

PosCommon Class
PosCommon Members
Microsoft.PointOfService Namespace
Release