1

Тема: Работа с модемами

Здравствуйте. Моя основная цель на этом этапе
Так как у меня в системе, например два com порта
получить сообщение следующего содержания
У Вас на компьютере имеются модемы:
1. Samsung 6712
2. SoftV 92 Data FaxModem

После того как я отсоединю сотовый телефон Samsung 6712, естественно это сообщение уже должно быть на один пункт меньше
Как этого добиться?????

2

Re: Работа с модемами

Случайно среди всей этой инфы нет, намёков на то положена ли трубка у одного из модемов?????, это тоже проблема века...

Option Explicit

Sub Модемы()

'http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/computermanagement/hardware/
'предпоследний скрипт: Retrieves information about all the modems installed in a computer
'для запуска в VBA заменить wscript.echo на debug.print или MsgBox$ или  Selection.TypeText Text:=

    On Error Resume Next

    Dim strComputer As String
    strComputer = "."

    Dim objWMIService As Object
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    Dim colItems As Object
    Set colItems = objWMIService.ExecQuery("Select * from Win32_POTSModem")

    Dim objItem As Object
    
Dim Количество_модемов As Byte
Dim Результат As String

    For Each objItem In colItems
    Количество_модемов = Количество_модемов + 1
        'MsgBox$ "Attached To - номер COM порта: " & objItem.AttachedTo
        'MsgBox$ "Blind Off: " & objItem.BlindOff
        'MsgBox$ "Blind On: " & objItem.BlindOn
        'MsgBox$ "Compression Off: " & objItem.CompressionOff
        'MsgBox$ "Compression On: " & objItem.CompressionOn
        'MsgBox$ "Configuration Manager Error Code: " & objItem.ConfigManagerErrorCode
        'MsgBox$ "Configuration Manager User Configuration: " & objItem.ConfigManagerUserConfig
        'MsgBox$ "Configuration Dialog: " & objItem.ConfigurationDialog
        'MsgBox$ "Country Selected - выбранная страна: " & objItem.CountrySelected
        'MsgBox$ "Device ID: " & objItem.DeviceID
        'MsgBox$ "Device Type - тип устройства: " & objItem.DeviceType
        'MsgBox$ "Driver Date: " & objItem.DriverDate
        'MsgBox$ "Error Control Forced: " & objItem.ErrorControlForced
        'MsgBox$ "Error Control Off: " & objItem.ErrorControlOff
        'MsgBox$ "Error Control On: " & objItem.ErrorControlOn
        'MsgBox$ "Flow Control Hard: " & objItem.FlowControlHard
        'MsgBox$ "Flow Control Off: " & objItem.FlowControlOff
        'MsgBox$ "Flow Control Soft: " & objItem.FlowControlSoft
        'MsgBox$ "Inactivity Scale: " & objItem.InactivityScale
        'MsgBox$ "Inactivity Timeout: " & objItem.InactivityTimeout
        'MsgBox$ "Index: " & objItem.Index
        'MsgBox$ "Maximum Baud Rate To SerialPort - максимальная скорость передачи последовательного порта: " & objItem.MaxBaudRateToSerialPort
        'MsgBox$ "Model - модель: " & objItem.Model
        'MsgBox$ "Modem Inf Path: " & objItem.ModemInfPath
        'MsgBox$ "Modem Inf Section: " & objItem.ModemInfSection
        'MsgBox$ "Modulation Bell: " & objItem.ModulationBell
        'MsgBox$ "Modulation CCITT: " & objItem.ModulationCCITT
        'MsgBox$ "Name - имя модема: " & objItem.Name
        'MsgBox$ "PNP Device ID: " & objItem.PNPDeviceID
        'MsgBox$ "Port SubClass: " & objItem.PortSubClass
        'MsgBox$ "Prefix: " & objItem.Prefix
        'MsgBox$ "Provider Name: " & objItem.ProviderName
        'MsgBox$ "Pulse - импульс: " & objItem.Pulse
        'MsgBox$ "Reset - сброс: " & objItem.Reset
        'имя (хуже)
        'MsgBox$ "Responses Key Name: " & objItem.ResponsesKeyName
        'спикер выбора режимов
        'MsgBox$ "Speaker Mode Dial: " & objItem.SpeakerModeDial
        'MsgBox$ "Speaker Mode Off: " & objItem.SpeakerModeOff
        'MsgBox$ "Speaker Mode On: " & objItem.SpeakerModeOn
        'MsgBox$ "Speaker Mode Setup: " & objItem.SpeakerModeSetup
        'MsgBox$ "Speaker Volume High: " & objItem.SpeakerVolumeHigh
        'MsgBox$ "Speaker Volume Info: " & objItem.SpeakerVolumeInfo
        'MsgBox$ "Speaker Volume Low: " & objItem.SpeakerVolumeLow
        'MsgBox$ "Speaker Volume Med: " & objItem.SpeakerVolumeMed
        'MsgBox$ "Status Info: " & objItem.StatusInfo
        'MsgBox$ "Terminator: " & objItem.Terminator
        'MsgBox$ "Tone - тон: " & objItem.Tone
        Результат = Результат & Количество_модемов & " " & objItem.Model & Chr$(13)

    Next
    
    MsgBox$ "Количество модемов: " & Количество_модемов & Chr$(13) & Результат

End Sub