RAS and VB .CF

A

A.C.P

I need RAS API to establish a gprs connection,
but I dont know c++.

Someone has or knows where I can find the structures and
messages of the functions RAS for vb?

thanks in advance

(excuse my english)
ACP
 
C

Chris Tacke, eMVP

It's not a simple API set, but all the info on P/Invoking is public and
there are a *lot* of samples on P/Invoking, so it's just going take time and
effort on your part.
 
A

Adam Goetz

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top