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
-
VB6, SQL 2005 & DMO
by elajaunie3 (1 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
Automating Excel from VB6.0
by epurdy (0 replies)
-
VB6 system conversion using VBA to Word 2007
by b.macgregor@vodamail.co.za (0 replies)
-
video not working with visual basic
by Jupiter 2 (9 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.