basic wrote:

> If someone knows what API these apps are using to trigger the DUN it 
> might get implemented if it doesn't depend on something like IE....
> 
> basic
> 

There are some different ways to achive a DUN connection. I did some 
tries some time ago, and looking back this is what seems to remain:


void DUN_Conection_v1()
{
        char Conexion[MAX_PATH];
        HKEY Reg;
        DWORD size=MAX_PATH;

        if (ERROR_SUCCESS!=RegOpenKeyEx(HKEY_CURRENT_USER, "RemoteAccess", 0, 
KEY_READ, &Reg))
                return;

        if (RegQueryValueEx(Reg, "Default", NULL, NULL, (LPBYTE)Conexion, 
&size)!=ERROR_SUCCESS)
        {
                RegCloseKey(Reg);
                return;
        }       

        if (strlen(Conexion)==0)
        {
                if (RegQueryValueEx(Reg, "InternetProfile", NULL, NULL, 
(LPBYTE)Conexion, 
&size)!=ERROR_SUCCESS)
                {
                        RegCloseKey(Reg);
                        return;
                }       
        }

        RegCloseKey(Reg);

        
     DWORD ID;

        InternetDial(NULL, Conexion, INTERNET_AUTODIAL_FORCE_UNATTENDED, &ID, 0);

}



void DUN_Disconnect_V1()
{
     RASCONN Conex[5];
     DWORD lpcb;
     DWORD conexiones=0;

     Conex[0].dwSize = sizeof(RASCONN);
     lpcb= 5 * sizeof(RASCONN);
     if (RasEnumConnections(Conex, &lpcb, &conexiones)==0)
     {
         for(DWORD i=0; i<conexiones; i++)
             RasHangUp(Conex[i].hrasconn);
     }
     if (conexiones>0)
         Sleep(5000);
}



DUN_Conection_V2:
        bresult=InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE,0);


DUN_Disconnect_V2:

        bresult=InternetAutodialHangup(0);



Reply via email to