If all you want to do is stop and start the grps connection via ras, here is
a snippet of a test wrapper I created for my own method of working out how
to do this :
extern "C" TESTDLL_API int ConnectGPRSSession(void)
{
HRASCONN RASConnection;
RASDIALPARAMS RASParams;
LPTSTR lpszEntryName;
BOOL password;
RASConnection = NULL;
// set info about the connection
memset (&RASParams, 0, sizeof (RASParams));
RASParams.dwSize = sizeof (RASDIALPARAMS);
lpszEntryName = _T("GPRS"); // hard coded connection name
_tcscpy (RASParams.szEntryName, lpszEntryName);
RasGetEntryDialParams (NULL, &RASParams,
&password);
// try to connect
if (RasDial(NULL, NULL, &RASParams, NULL, NULL, &RASConnection) != 0)
{ // did connection return an immediate error?
if (RASConnection != NULL)
RasHangUp(RASConnection);
return -1;
};
return 1;
}
extern "C" TESTDLL_API int DisconnectGPRSSession(void)
{
int index; // An integer index
TCHAR szError[100]; // Buffer for error codes
DWORD dwError, // Error code from a function call
dwRasConnSize, // Size of RasConn in bytes
dwNumConnections; // Number of connections found
RASCONN RasConn[20]; // Buffer for connection state data
// Assume no more than 20 connections.
RasConn[0].dwSize = sizeof (RASCONN);
dwRasConnSize = 20 * sizeof (RASCONN);
// Find all connections.
if (dwError = RasEnumConnections (RasConn, &dwRasConnSize,
&dwNumConnections))
{
wsprintf (szError, TEXT("RasEnumConnections Error: %ld"), dwError);
}
// Terminate all of the remote access connections.
for (index = 0; index < (int)dwNumConnections; ++index)
{
if (dwError = RasHangUp (RasConn[index].hrasconn))
{
wsprintf (szError, TEXT("RasHangUp Error: %ld"), dwError);
}
};
return 1;
}