We help IT Professionals succeed at work.

Create Dial Up Connection

stuartbarber
stuartbarber asked
on
Can anybody help me?

I want to create a Dial Up Connection programatically. I used RasSetEntryProperties in Win2000 but this gives problems in Win98.

Can anybody help me out or point me in the right direction.
Comment
Watch Question

Commented:
Please be more specific.  

RasSetEntryProperties works perfectly well in Win98 as well as 2000.

Author

Commented:
Here is my code -

RASENTRY re;
DWORD reSize = sizeof(re);

re.dwSize = sizeof(RASENTRY);

re.dwfOptions = RASEO_UseCountryAndAreaCodes |
          RASEO_IpHeaderCompression |
          RASEO_RemoteDefaultGateway |
          RASEO_ModemLights |
          RASEO_SwCompression;

re.dwCountryID = 44;
re.dwCountryCode = 44;
strcpy(re.szAreaCode, "0845");
strcpy(re.szLocalPhoneNumber, "2120666");
re.dwAlternateOffset = 0;

re.dwFramingProtocol = RASFP_Ppp;

strcpy(re.szDeviceType, "modem");
strcpy(re.szDeviceName, "Sportster");

dwRet = RasSetEntryProperties(NULL, "Uptech", &re, sizeof(RASENTRY), NULL, NULL);


On return, dwRet equals 87 (Invalid Parameter).

Commented:
RASENTRY re;
DWORD reSize = sizeof(re);

re.dwSize = sizeof(RASENTRY);
::ZeroMemory(&re, sizeof(re));

re.dwfOptions = RASEO_UseCountryAndAreaCodes |
         RASEO_IpHeaderCompression |
         RASEO_RemoteDefaultGateway |
         RASEO_ModemLights |
         RASEO_SwCompression;

re.dwCountryID = 44;
re.dwCountryCode = 44;
strcpy(re.szAreaCode, "0845");
strcpy(re.szLocalPhoneNumber, "2120666");
re.dwAlternateOffset = 0;

re.dwFramingProtocol = RASFP_Ppp;

strcpy(re.szDeviceType, "modem");
strcpy(re.szDeviceName, "Sportster");

dwRet = RasSetEntryProperties(NULL, "Uptech", &re, sizeof(RASENTRY), NULL, NULL);

Author

Commented:
Added the ZeroMemory line. Still the same result.

Get the same return code from RasGetEntryProperties too!
dwRet = RasSetEntryProperties(NULL, "Uptech", &re, &reSize, NULL, NULL);

Author

Commented:
The ZeroMemory line was a step in the right direction. Thanks.

However the answer, I discovered in the end, was a missing line:-

  re.dwfNetProtocols = RASNP_NetBEUI;


Commented:
It's always hard to find missing things vs. wrong things...

Author

Commented:
Sorry it's taken me so long to accept! Thanks!

It always helps to bounce these things around

Explore More ContentExplore courses, solutions, and other research materials related to this topic.