Home    Prev Next    
Contents
Programming For Parallel Port Device
Overview
Programmers Guide
Scenario
I/O Ports control
Single read/write operations
Data array read/write operations
Hardware interrupts handling at user level
Common Issues
LPT Support Routines
Common Procedures
OpenRapidLpt
IsRapidLptOpened
CloseRapidLpt
OpenPort
ClosePort
GetNumLPTs
GetPortNumber
GetReadMode
SetReadMode
LPT specific functions
Parallel port info
GetBasePortAddress
GetBaseSpan
GetEcpAddress
GetEcpSpan
GetInterruptVector
GetInterruptLevel
GetInterruptAffinity
GetInterruptMode
Parallel port registers
GetDataPort
SetDataPort
GetStatusPort
SetStatusPort
GetControlPort
SetControlPort
GetEcrPort
SetEcrPort
GetEPPAddressPort
SetEPPAddressPort
GetEPPDataPort
SetEPPDataPort
Centronix signals
GetLptBusy
GetLptPaperEnd
GetLptSlct
GetLptAutofd
SetLptAutofd
GetLptError
LptInit
LptSelectIn
GetPrinterReady
Parallel port modes
GetCurrentLptMode
SetCurrentLptMode
GetIsPresent
GetIsPS2Present
GetIsEcpPresent
Work with pins
GetPin
SetPin
Work with bits
GetDataPortBit
SetDataPortBit
GetStatusPortBit
SetStatusPortBit
GetControlPortBit
SetControlPortBit
GetCfgaPortBit
SetCfgaPortBit
GetCfgbPortBit
SetCfgbPortBit
GetEcrPortBit
SetEcrPortBit
Direct Port I/O
GetPortByte
GetPortWord
GetPortLong
SetPortByte
SetPortWord
SetPortLong
ReadPortBuffer
WritePortBuffer
Hardware Interrupts
UnmaskLptIrq
MaskLptIrq
GetInterruptCounter
GetPortNumber
Go to RapidDriver Main Page

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);