Hi
I want to build an application which AUTOMATICALLY connects to the internet via dialup connection (previously set in Dialup networking), do something over the connection (for example, send, get email, doesn't matter, I know how to do it) then AUTOMATICALLY disconnects!
some sample code?
please help
thanks
// this connects to the default dialup account
connected:=InternetAutoDial(INTERNET_AUTODIAL_FORCE_ONLINE or INTERNET_AUTODIAL_FORCE_UNATTENDED, 0);
//do stuff
InternetAutodialHangup(0);
another way is to specify the name of the connection you wish to use:
if InternetDial(0, PChar(ConnectionName), INTERNET_AUTODIAL_FORCE_UNATTENDED, dwConn, 0) <> ERROR_SUCCESS then exit;
// do stuff
InternetHangup(dwConn, 0);
uses wininet;
// this connects to the default dialup account
connected:=InternetAutoDia
//do stuff
InternetAutodialHangup(0);
another way is to specify the name of the connection you wish to use:
if InternetDial(0, PChar(ConnectionName), INTERNET_AUTODIAL_FORCE_UN
// do stuff
InternetHangup(dwConn, 0);
should be simple enough
here is the MSDN link :
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/wininet/overview/establish.asp