| Returns the current LPT port number.
|
Language
|
Description
|
C/C++
|
ULONG GetPortNumber ( HANDLE hLpt, ULONG Index )
|
Delphi
|
function GetPortNumber ( hLpt : THANDLE; Index : Integer) : Integer; stdcall
|
VB
|
Function GetPortNumber ( ByVal hLpt As Long, ByVal PortIndex As Long) As Long
|
Parameters:
hLpt - the handle returned by a successful call to OpenRapidLpt
Index - zero-based index which indicates the number of port detected by RapidLpt. For exmaple, Index = 0 may indicate LPT1,
Index = 2 - LPT3 an so on.
Return Value :
- Current LPT port number (1 - LPT1, 2 - LPT2 and so on).
Comments:
Can be used only after the call of GetNumLPTs function.
Example (VC++): enumerating LPT ports installed on the PC and putting them into combo box.
int n = GetNumLPTs(hLpt);
for(int i=0; i<n; i++)
{
sprintf(buf, "LPT %d", GetPortNumber(hLpt,i));
m_lptlist.AddString(buf);
}
Example (VC++): getting the port number from the combo box (zero-based index) and opening the port:
CurrPortNumber = GetPortNumber ( hLpt, m_lptlist.GetCurSel() );
OpenPort(hLpt,CurrPortNumber);
|