Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wireless Signal Meter - Component
Message
From
19/07/2009 11:14:52
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01412596
Message ID:
01413253
Views:
97
This message has been marked as the solution to the initial question of the thread.
>Anybody know of a 3rd party component that will work with VFP8 that will detect:
>
>1. Wireless signals and strength
>2. If current connection is wireless and if so the strength?
>3. Would work with XP or Vista?
>
>Thanks
>
>Kirk


I have some code from 2007 that might get you started. However, it does not work in Vista.
*--Courtesy 2007 Mike Gagnon and Microsoft TechNet Scripting Guy March 2007
CREATE CURSOR wireless (NAME c(40),prefered c(10),ACTIVE l,R_signalStrength c(10), bars c(15))
strServer = "."
TRY
    objWMI = GETOBJECT("winmgmts://" + strServer + "/root\WMI")
    IF TYPE('objWMI') = "O"
        objInstances = objWMI.InstancesOf("MSNdis_80211_ServiceSetIdentifier Where active=true",48)
        IF TYPE('objInstances') = "O"
            TRY
                FOR EACH objInstance IN objInstances
                    IF !"MINIPORT" $ UPPER(objInstance.instancename)
                        INSERT INTO wireless (NAME) VALUES (objInstance.instancename)
                        SELECT wireless
                        REPLACE ACTIVE WITH objInstance.ACTIVE
                        WMIClass = GETOBJECT("winmgmts://" + strServer + "/root\WMI")
                        lcSql = "Select * from MSNdis_80211_ServiceSetIdentifier Where InstanceName ='[instancename]'"
                        lcSql = STRTRAN(lcSql,'[instancename]',objInstance.instancename)
                        WMIObj = WMIClass.ExecQuery(lcSql)
                        FOR EACH tmp IN WMIObj
                            cId = ""
                            FOR i = 0 TO tmp.Ndis80211SsId(0)
                                cId = cId + CHR(tmp.Ndis80211SsId(i + 4))
                            NEXT
                            cId = SUBSTR(cId,1,LEN(ALLTRIM(cId))-1)
                            REPLACE prefered WITH  UPPER(cId) IN wireless
                        NEXT
                    ENDIF
                    WMIClass = GETOBJECT("winmgmts:\\.\root\wmi")
                    lcSql = "Select * from MSNdis_80211_ReceivedSignalStrength Where InstanceName ='[instancename]'"
                    lcSql = STRTRAN(lcSql,'[instancename]',objInstance.instancename)
                    WMIObj = WMIClass.ExecQuery(lcSql)
                    FOR EACH tmp IN WMIObj
                        REPLACE R_signalStrength WITH ALLTRIM(STR(tmp.Ndis80211ReceivedSignalStrength))+'dbM' IN wireless
                        intStrength = tmp.Ndis80211ReceivedSignalStrength
                        DO CASE
                            CASE intStrength > -57
                                strBars = "5 Bars"
                            CASE intStrength > -68
                                strBars = "4 Bars"
                            CASE intStrength > -72
                                strBars = "3 Bars"
                            CASE intStrength > -80
                                strBars = "2 Bars"
                            CASE intStrength > -90
                                strBars = "1 Bar"
                            OTHERWISE
                                strBars = "Strength cannot be determined"
                        ENDCASE
                        REPLACE bars WITH strBars  IN wireless
                    NEXT

                NEXT
                BROWSE
            CATCH TO loError
                MESSAGEBOX('Unable to retrieve wireless connection strength information.')
            ENDTRY
        ELSE
           MESSAGEBOX('Unable to retrieve wireless connection strength information.')
        ENDIF
    ELSE
       MESSAGEBOX('Unable to retrieve wireless connection strength information.')
    ENDIF
CATCH TO loError
    MESSAGEBOX('Unable to retrieve wireless connection strength information.')
ENDTRY
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform