Mcpenum, Parameters, Return value – MagTek MAGTEK User Manual
Page 62: Remarks, The mcpenum function
MagTek Communications Protocol, Driver Reference Manual
56
McpEnum
This function is used to enumerate (get the names of) all of the MCP compliant devices configured and
connected on the host computer.
DWORD McpEnum( PMCPBUS pMCPBUS );
Parameters
pMCPBUS
Pointer to the MCPBUS structure used by the MCP API function to perform its operation.
The following structure members are used as input parameters.
Member
Meaning
dwContext
0 on first call (restart enumeration); value left unmodified on subsequent
invocations to get the next device name.
lpOutBuffer Pointer
to
storage buffer to receive the next device name.
dwOutBufferSize Size
of buffer pointed to by lpOutBuffer
The following structure members are used as output parameters.
Member
Meaning
dwContext
Enumeration Context, used in subsequent calls to McpEnum (do not modify)
lpOutBuffer Buffer
pointed to by this member contains the device name (null terminated)
dwResponseLen
Length of device name (including terminating null) in output buffer
Return Value
The returned value indicates the outcome of the enumeration function.
Value
Meaning
MCP_ST_OK
Success. The next device name is located in the callers Output Buffer
pointed to by lpOutBuffer.
MCP_ST_NOT_FOUND
No more devices found or device not found
MCP_ST_OVERFLOW
The Output Buffer is not large enough to hold the returned value
MCP_ST_FAILED Other
error.
Remarks
The device name returned in the callers Output Buffer can be used in a subsequent McpOpen call. The
first time this function is called, the Context member is set to zero indicating to restart the enumeration
process. On subsequent calls, the Context member should be left unchanged so that the next device name
can be returned. By calling this function in a loop, a host application can enumerate all devices.