Library code snippets
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!
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
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 that regularly..
Usually the ambigous name detected means that you already have a variable declared that way.
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
This thread is for discussions of AutoDial with WinInet API.