Information générale
Catégorie:
Fonctions Windows API
Titre:
How to force a dial-up connection to start-- Wininet.DLL?
Hi,
in my application I want to check if there is an open Internet connection and if there is not - force the connect with the default dial-up connection.
I tried this:
DECLARE INTEGER InternetGetConnectedState IN Wininet.dll STRING@, INTEGER
res = PADR('', 4, CHR(0))
? InternetGetConnectedState(@res,0)
The return value is 1(which is guess TRUE) so there is an open Internet conection, but then I disconnected and running the same function I got the same result???!!! In the res dword I got back 18(which I don't know what it is - the spec is talking about values 1,2,4,8)
After this confusing result I tried:
DECLARE INTEGER InternetAutodial IN Wininet.dll INTEGER,INTEGER
? InternetAutodial(1,0)
** 1 stands for: "Forces an online Internet connection"
with no Internet connections this functions returns 0
With Internet connection returns 1.
But I expected to pop up the default dial-up connection.
What else can I use?
I tried this function:
DECLARE INTEGER RasEnumEntries ;
IN rasapi32.dll ;
STRING reserved,;
STRING phonebook,;
STRING @rasentry,;
INTEGER @lnSize,;
INTEGER @lnEntries
lcBuffer = PADL('', 20*(4+257), CHR(0))
lnlen = len(lcbuffer)
ln2=0
? RasEnumEntries(chr(0), "",@lcBuffer,@lnlen,@ln2)
I got back an error message saying :
ERROR_BUFFER_INVALID
Any suggestions?
Thanks,
Vali
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement