Try this code:
#DEFINE INTERNET_AUTODIAL_FORCE_ONLINE 1
#DEFINE INTERNET_AUTODIAL_FORCE_UNATTENDED 2
DECLARE INTEGER GetActiveWindow IN user32
DECLARE INTEGER InternetAutodial IN wininet.dll;
INTEGER dwFlags, INTEGER dwReserved
DECLARE INTEGER InternetAutodialHangup IN wininet.dll;
INTEGER dwReserved
* To prompt the user to connect to the Net
*= InternetAutodial (INTERNET_AUTODIAL_FORCE_ONLINE, 0)
* To automatically start dialling
*? InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, 0)
? InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED, GetActiveWindow())
* To disconnect an automatically dialled connection
*= InternetAutodialHangup(0)
* * *
What is returned?
The InternetAutodial function requires IE 4.0 or later.
MSDN does not specify how to process an error state. Though I think you could try the InternetGetLastResponseInfo function:
DECLARE SHORT InternetGetLastResponseInfo IN wininet;
INTEGER @ lpdwError,;
STRING @ lpszBuffer,;
INTEGER @ lpdwBufferLength
Run this code after an unsuccessfull call:
LOCAL nError, cBuffer, nBufsize
nError = 0
nBufsize = 250
cBuffer = Repli(Chr(0), nBufsize)
? InternetGetLastResponseInfo(@nError, @cBuffer, @nBufsize)
? SUBSTR(cBuffer, 1, nBufsize)
* * *
Check the following links:
http://www.vb-world.net/tips/tip478.html http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/establishing_a_dial_up_connection_to_the_internet.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetautodial.asp* * *
More WININET API calls at
http://www.news2news.com/vfp?group=92