Hi,
Is there a way to get a list of the available COM ports on a system?
Thanks,
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Jeff Barnes
(FWH 16.11, xHarbour 1.2.3, Bcc730)
Hi,
Is there a way to get a list of the available COM ports on a system?

//-------------------------------------------------------------------------//
METHOD EnumKey () CLASS TReg32
LOCAL i := 0, nError := 0
LOCAL cBuffer := Space (255)
LOCAL nBufSize := 255
LOCAL cClass := Space (255)
LOCAL nClsSize := 255
LOCAL aRet := {}
While (nError := RegEnumKeyExA( ::nHandle, i++, @cBuffer, nBufSize,0,cClass, nClsSize )) == ERROR_SUCCESS
cBuffer := StrTran (cBuffer,",","\") // Replace "," with "\"
AADD (aRet,cBuffer)
End
::nError := nError
RETURN (aRet)
//-------------------------------------------------------------------------//
DLL32 static ;
FUNCTION RegEnumKeyExA(nhKey AS LONG ,;
nIndex AS LONG ,;
@cBuffer AS LPSTR ,; //By reference
@nBufSize AS PTR ,; //By reference
nReserved AS LONG ,; //Must be NULL
@cClass AS LPSTR ,; //By reference (can be NULL)
@nClsSize AS PTR ,; //By reference (can be NULL)
@pFileTime AS PTR ); //By reference (can be NULL)
;
AS LONG PASCAL LIB "ADVAPI32.DLL"