高分求助!!!怎样用VC在98下建立一拨号连接?
BOOL CreateTdxConnection()
{
//列举设备
RASDEVINFO *pdevinfo = new RASDEVINFO[10];
DWORD cb=10*sizeof(RASDEVINFO);
DWORD num_devices;
pdevinfo[0].dwSize = sizeof(RASDEVINFO);
DWORD ret = RasEnumDevices(pdevinfo, &cb, &num_devices);
if(ret != 0 || num_devices < 1) { delete pdevinfo; return FALSE; }
for(int i=0;i < num_devices;i++)
{
if(strcmp(pdevinfo[i].szDeviceType,RASDT_Modem)==0)
break;
}
if(i >= num_devices) { delete pdevinfo; return FALSE; }
//填充RASENTRY接口
RASENTRY entry;
memset(&entry, 0, sizeof(RASENTRY));
entry.dwSize = sizeof(RASENTRY);
entry.dwfOptions = RASEO_RemoteDefaultGateway | RASEO_ModemLights | RASEO_IpHeaderCompression | RASEO_SwCompression | RASEO_NetworkLogon;
entry.dwfNetProtocols = RASNP_Ip; //TCPIP协议
entry.dwFramingProtocol = RASFP_Ppp; //PPP方式
strcpy(entry.szDeviceType, pdevinfo[i].szDeviceType);
strcpy(entry.szDeviceName, pdevinfo[i].szDeviceName);
strcpy(entry.szLocalPhoneNumber,"");
ret = RasSetEntryProperties(NULL,"拨号连接1",&entry,sizeof(RASENTRY),NULL,0);
delete pdevinfo;
if(ret != 0) return FALSE;
return TRUE;
}
这段代码好象在98和Me下不生效(在2000下可以)!!
Help!