WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Modems and Dial-up Networking

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Determine DUN Speed

Keywords: 	 DUN Speed connection speed

Question:

Has anyone found a (quick) way to determine the speed of a DUN connection in 95 and NT4? I'd like to be able to distinguish between ISDN and modem connections during a logon script. I've tried various copy a file of known size and see how long it takes, but the test itself is prohibitively long unless the connection is ISDN.

Answer:

To determine DUN speed I use the following method:
  1. Add the wwwsk34I extender
  2. Look for a parent named "Connected to" or one of the names from DunItemize()
  3. Use WinItemChild() to list the children of the parent found in 2
  4. The connection speed can be parsed out of the list in 3. It will be a child named "Connected at bps".
I've used this successfully on 95 and 98 systems. No idea if it works on NT. BTW DunItemize is only needed because 95A renames the "Connected to" window when it is minimized. On 95B, 95C, and 98, "Connected to" is sufficient.
;--- Author: Mike Smith, smithm@post.queensu.ca
   gosub InitBps
   Message("InitBps","Bps = %Bps%")
   exit

;--- Subroutine InitBps
;    What is the speed of the user's dial-up connection?  If they are
; currently dialed in the speed is contained in the "Connected at" child
; of the "Connected to" window.  On 95A systems, the name of the "Connected at"
; window changes to the name of the connection when it is minimized.  Thankfully,
; the Internet extender makes it a snap to know what the possible names are.
;    The speed is assigned to Bps.  -1 is returned for "Don't know", -2 for
; error loading the Internet extender.
:InitBps
   if AddExtender("wwwsk34I.dll")
      Bps = -1
      ibParents = StrCat("Connected to",@Tab,DunItemize())
      for ibi=1 to ItemCount(ibParents,@Tab)
         ibParent = ItemExtract(ibi,ibParents,@Tab)
         if WinExist(ibParent)
            ibChildren = WinItemChild(ibParent)
            ibPos = StrIndexNc(ibChildren,"Connected at ",1,@FwdScan)
            if ibPos > 0
               ibSpeed = StrReplace(ItemExtract(1,StrSub(ibChildren,ibPos + 13,-1)," "),",","")
               if IsNumber(ibSpeed)
                  Bps = ibSpeed
                  break
               endif
            endif
         endif
      next
   else
      Bps = -2
   endif
   Drop(ibParents,ibi,ibParent,ibChildren,ibPos,ibSpeed)
   return
;--- End Subroutine InitBps

Article ID:   W13288
Filename:   Determine DUN Speed.txt
File Created: 2001:03:01:14:31:14
Last Updated: 2001:03:01:14:31:14