Results 1 to 5 of 5

Thread: Can you use a lib in VBscript??

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    3

    Exclamation

    I have some code from VB that checks the wininet.dll file using the lib function as below:

    Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags, ByVal dwReserved ) End Function

    Can this be done in VBscript, I'm having a tough time finding any information on this.

    The goal is to retrieve the connection flags from the dll to verify someone's online status.

    Any help much appreciated.

    Thanks,

    Rossco

  2. #2
    Lively Member harsoni's Avatar
    Join Date
    Oct 2000
    Posts
    118

    Angry

    Hi,
    I am sorry to say that u cannot access a System lib through vbscript, this is because IE doesn't allow this due to security issue.... so the other way arround is access the lib using VB DLL function and call this DLL function from VBSCRIPT... i hope this helps

    Sonia

  3. #3
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    If your target is IE5, then you can determine the connection with the client Caps behavior. I have a sample, it's just i can't find my book CD, so i don't want to type it in if it's not what you want
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    3

    Smile Thanks harsoni and gwdash...

    Thanks for the help!

    gwdash, if you have an example for me to use, I'd love to see it.

    Thanks again,

    Rossco

  5. #5
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    ok, here goes
    Code:
    <HTML xmlns:IE>
    <HEAD>
    <STYLE>
    @media all {
        IE\:clientCaps {behavior:url(#default#clientcaps)}
    }
    </STYLE>
    <SCRIPT>
    function showConnectionType() {
       var thisConnection = oClientCaps.connectionType;
    
       if (thisConnection == "lan") {
          alert("You are on a LAN (network) connection");
       } else {
          if (thisConnection == "modem") {
             alert("You are on a modem (dial-up) connection");
          } else {
             alert("You are borwsing in offline mode");
          }
       }
    }
    </SCRIPT>
    </HEAD>
    
    <BODY>
       <IE:clientCaps ID="oClientCaps" />
       <SCRIPT>showConnectionType()</SCRIPT>
    </BODY>
    </HTML>
    I did not write this code. All credit goes to the athors of the book Microsoft&copy; Internet Explorer 5 Unleased
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width