No announcement yet.

simple callerID app?

  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    This works with ani-232 adapters:
    h = FREEFILE
    comport$ = "COM"+ sPortNumber
    COMM OPEN Comport$ AS h
    COMM SET #h, RXBUFFER = 4096
    COMM SET #h, BAUD = 1200
    COMM SET #h, BYTE = 8
    COMM SET #h, STOP = 0


    • #22
      You can get (a lot of) Modem info through WMI:
      [edit] Added status and comport info[/edit]

      ' ========================================================================================
      ' WMI example - Retrieving Modem information
      ' ========================================================================================
      #Compile Exe
      #Dim All
      #Include "TB_WMILIB.INC"    ' // WMI helper functions
                                  ' see [url][/url]
      ' ========================================================================================
      ' Main
      ' ========================================================================================
      Function PBMain
         Local hr As Long                   ' // HRESULT
         Local oServices As Dispatch        ' // Services object
         Local vServices As Variant         ' // Services object reference
         Local oItems As Dispatch           ' // Generic collection object
         Local vItems As Variant            ' // Generic collection object reference
         Local oItem As Dispatch            ' // Generic item object
         Local vItem As Variant             ' // Generic item object reference
         Local penum As Dword               ' // Collection's enumerator reference
         Local vCount As Variant            ' // Number of items in the collection
         Local vVar As Variant              ' // General purpose variant
         Local vRes As Variant              ' // General purpose variant
         Local i As Long                    ' // Loop counter
         Local x As Long                    ' // Loop counter
         Local Temp As String               ' // Local string storage
         Dim vArray(0) As Variant           ' // General purpose array of variants
         ' // Connect to WMI using a moniker
         hr = WmiGetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2", vServices)
         If hr <> %S_OK Then GoTo Terminate
         Set oServices = vServices
         vServices = Empty
         If IsFalse IsObject(oServices) Then GoTo Terminate
         ' // Execute a query to get a reference to the collection of running processes
         vVar = "SELECT * FROM Win32_POTSModem"
         Object Call oServices.ExecQuery(vVar) To vItems
         If ObjResult Then GoTo Terminate
         Set oItems = vItems
         vItems = Empty
         If IsFalse IsObject(oItems) Then GoTo Terminate
         ' // Retrieve the number of items in the collection
         Object Get oItems.Count To vCount
         ' // Retrieve a reference to the collection's enumerator
         hr = Wmi_NewEnum(ObjPtr(oItems), penum)
         If hr <> %S_OK Or penum = %NULL Then GoTo Terminate
         ' // Iterate throught the collection of objects.
         For i = 1 To Variant#(vCount)
            ' // Retrieve a reference to the next object in the collection
            hr = WmiEnum_NextItem(penum, vItem)
            If hr <> %S_OK Then Exit For
            Set oItem = vItem
            If IsFalse IsObject(oItem) Then Exit For
            Object Get oItem.DeviceID To vRes
            Temp = Temp & "Device ID: " & $Tab & Variant$(vRes) & $Cr
            Object Get oItem.Caption To vRes
            Temp = Temp & "    Caption:" & $Tab & Variant$(vRes) & $Cr
            Object Get oItem.DeviceType To vRes
            Temp = Temp & "    Device type:" & $Tab & Variant$(vRes) & $Cr
            Object Get oItem.AttachedTo To vRes
            Temp = Temp & "    Attached to:" & $Tab & Variant$(vRes) & $Cr
            Object Get oItem.Status To vRes
            Temp = Temp & "    Status:" & $Tab & $Tab & Variant$(vRes) & $Cr
            Object Get oItem.StringFormat To vRes
            Temp = Temp & "    Uses:" & $Tab & $Tab & Variant$(vRes) & $Cr & $Cr
         MsgBox Temp,, "WMI Modem Info:"
         ' // Release the collection enumerator
         WmiRelease penum
         ' // Release the collection object
         If IsObject(oItems) Then Set oItems = Nothing
         If IsObject(oServices) Then Set oServices = Nothing
      End Function
      ' ========================================================================================
      Last edited by Peter Lameijn; 28 Mar 2009, 09:13 AM.


      • #23
        WMI for win 9x?


        WMI sounds good, but I have been warned that it will not function on Win 98. I looked through MSDN and could not confirm or deny this. Wikipedia confirms this, but we all know it is not always realiable. MSDN says it ws introduced with Windows 2000. Our software must be supported on Win 98 through Vista and preferrably on Win 95 also. So, I think that WMI is not an option for us. However, I do sincerely appreciate the suggestion.
        Bill Scharf


        • #24
          WMI seems to be supported for Win95/98/98SE/NT4, see:


          • #25

            You are correct. I did not word my previous post correctly. I should have said that it looks like WMI will not function *without additional software* on Win98 machines. One of the requirements for our project is supporting Win98 through Vista with nothing more than Windows updates. No add-ons, downloads, or system tweaks allowed. We have thousands of users and if this project means downloading or redistributing add-ons then the users will not be happy and the project will be axed.

            Again, I appreciate your response and it is a very good idea, but I cannot use that idea for this project.
            Bill Scharf