Peter, you are phenomenal. I've updated your nifty code to work on PBWin:
'
Code:
'PBWin 8.04 XP Pro(SP3) 'http://www.powerbasic.com/support/pbforums/showthread.php?t=6468&highlight=modem+detection 'by Peter Lameijn 'Changes by GHL '================================================================================================== ' Modem detection example. PST_xxx equates are in Winbase.h '================================================================================================== '================================================================================================== #Include "win32api.inc" Function PBMain () As Long Local lCnt&, lRet&, lComm&, lCommProp As CommProp, lCommName As Asciiz * 128,lVal As Long Local Ports_Found$ ' Color 15,0 For lCnt = 1 To 8 lCommName = "COM" + Trim$(Str$(lCnt)) lComm& = CreateFile (lCommName, _ %GENERIC_READ Or %GENERIC_WRITE, _ 0, _ ByVal %Null, _ %OPEN_EXISTING, _ 0, _ ByVal %Null) Reset lval '<<< necessary If (lComm& <> %INVALID_HANDLE_VALUE) Then lRet = GetCommModemStatus (lComm&,lVal) If lVal Then Ports_Found$ = Ports_Found$ & lCommName & $CrLf CloseHandle lComm End If Else ' Print lCommName + " - No such port" ? "%INVALID_HANDLE_VALUE",,"Bummer" Exit Function End If Next If Ports_Found$ > "" Then ? Ports_Found$,, "Modems Found" Else ? "",, "No Modems Found" End If End Function '
"Sex is not the answer. Sex is the question."
"Yes" is the answer.
Swami X
=============================================
Leave a comment: