Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 22,352 times

Related Categories

AutoDial with WinInet API

This is an addition to my collection of the Windows Inet DLL functions. Shows how to Auto-Dial without the user having to insert usernames and passwords. All Automated!

Simply insert this into a module:

Option Explicit
Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As Long, ByVal hwndParent As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1&
Private Const INTERNET_AUTODIAL_FORCE_UNATTENDED = 2&
Private Const INTERNET_AUTODIAL_FAILIFSECURITYCHECK = 4&
Public Enum AutoDialsFlags
   ADF_FORCE_ONLINE = INTERNET_AUTODIAL_FORCE_ONLINE
   ADF_FORCE_UNATTENDED = INTERNET_AUTODIAL_FORCE_UNATTENDED
End Enum

Public Function Autodial(hwndParentWindow As Long, lOption As AutoDialsFlags, Optional bFailIfSecurityCheck As Boolean = True) As Boolean
Dim lFlags As Long, lRetValue As Long
On Error GoTo ErrHandle
   If bFailIfSecurityCheck Then lFlags = lOption Or INTERNET_AUTODIAL_FAILIFSECURITYCHECK
   lRetValue = InternetAutodial(lFlags, hwndParentWindow)
   If lRetValue <> 0 Then Autodial = True Else Autodial = False
ErrHandle:
   Exit Function
End Function


then call the function to autodial like this:

Autodial hWnd, ADF_FORCE_UNATTENDED, True


This would be a godsend to those writing download managers etc!

Work Work Work
Currently I'm working at Vividas Pty Ltd and studying at Swinburne University. My time on DeveloperFusion is limited due to workloads on both parts, I do however keep a Blog that gets updated fairly regularly with lots of Techno-babble...

I also have a software business called WebSoftware Systems in Australia, the primary product we have at the moment is HotHTML which started life as a simple VB6 based HTML editor and is now a full blown text/web development IDE. I'm currently also working on the v4.0 release in .NET 2.0.

Comments

  • Posted by Thushan Fernando on 12 Jul 2003

    maybe theres something declared in there already called AutoDialsFlags... check in your code.

    apologies for hte delay in getting back to you... i dont check what feedback i have on my sbumissions t...

  • Regarding ambigous name detected

    Posted by andioliver on 20 May 2003

    Usually the ambigous name detected means that you already have a variable declared that way.

  • error

    Posted by gruizel on 16 Apr 2003

    Hi,
    I've tried this code, and it gives me an error "ambiguous name detected"
    on the "Public Enum AutoDialsFlags"

    Nou I can't figure this out.

    pls help

    using vb6 win98