It is currently Sun Jan 24, 2021 10:57 am

All times are UTC + 1 hour

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Tip: Automatic connect/disconnect to the Internet
PostPosted: Wed Jan 08, 2003 4:10 am 
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Code updated For 5.20+

Restored from previous forum. Originally posted by PB.

This tip (for Windows only) assumes that you have a default connection
setting for the Internet in your Dial-Up Networking folder, and that
your username/password is automatic and doesn't require typed entry.

; Connect/Disconnect from the Internet via default connection.
; By PB -- please feel free to use in any way you wish.  :)
; Note 1: Requires Win98 or higher, or Win95 with Internet Explorer 4.
; Note 2: Username and password must be "remembered" for this to work.
If InternetGetConnectedState_(0,0)=#True
  Debug "Already connected by another process!"
  isp$="D-Link iPrimus DSL Connection" ; Default connection name.
  ConnectionID=1 ; 1 = Any number you want to identify this connection.
  If InternetDial_(0,isp$,2,@ConnectionID,0) <> #ERROR_SUCCESS
    Debug "Connection was unsuccessful..."
    Debug "Connected successfully!"
    Debug "Press SPACE when ready to disconnect..."
    GetAsyncKeyState_(#VK_SPACE) ; Clear space buffer before testing.
    Repeat : Sleep_(1) : Until GetAsyncKeyState_(#VK_SPACE)=-32767
    Debug "Disconnecting... (May take a few seconds)."
    Debug "Disconnected."

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 8 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye