想要通过EVC实现 创建一个拨号连接,实现设置modem的属性,我知道是通过RasSetEntryProperties的倒数第二个参数设置modem属性,
RASlpdInfo lpb;
unsigned long lpbSize = sizeof(RASlpdInfo);
memset(&lpb, 0, lpbSize);
dwSize = sizeof(RasEntry);
memset(&RasEntry, 0, dwSize);
RasEntry.dwSize = dwSize;
wcscpy(RasEntry.szDeviceName, L"mymmm");
wcscpy(RasEntry.szDeviceType, L"modem");
RasEntry.dwCountryCode = 86;
wcscpy(RasEntry.szAreaCode, L"10");
TCHAR szLocalPhoneNumber[RAS_MaxPhoneNumber + 1] = { 0 };
wsprintf(szLocalPhoneNumber, L"%s", L"*99***1#");
wcscpy(RasEntry.szLocalPhoneNumber, szLocalPhoneNumber);
RasEntry.dwfOptions = 4194304;
RasEntry.dwfNetProtocols = RASNP_Ip;
RasEntry.dwFramingProtocol = RASFP_Ppp;
lpb.Reserved1 = 0x20;
lpb.WaitForCreditcard = 0;
lpb.WaitForConnect = 120;
lpb.Reserved2 = 0;
lpb.Flowcontrol = 0;
lpb.Unknow1 = 1;
lpb.Reserved3 = 0;
lpb.BaudRate = 9600;
lpb.Reserved4 = 0;
lpb.Configbit2 = 0;
lpb.DataBit = 8;
lpb.StopBit = 0;
lpb.ParityBit = 0;
TCHAR szATComd[420] = {0};
sprintf(szATComd, "+CGDCONT=1,$IP$,$CMNET$");
szATComd[11] = 0x22;
szATComd[14] = 0x22;
szATComd[16] = 0x22;
szATComd[22] = 0x22;
strcpy(lpb.AttachedCmd, szATComd);
if (dwError = RasSetEntryProperties(NULL, L"mymmm",
&RasEntry, sizeof(RASENTRY), (LPBYTE)(&lpb), lpbSize)){
CString err;
err.Format(L"RasSetEntryProperties error :%d",dwError);
::AfxMessageBox(err);
}
return 1;
这是从网上找的一段代码,可以设置基本的号码等,但是串口参数啊(还是默认的19200),modem的调制解调器命令等无法设置。
我不知道问题出在哪里 ,网上也有说用TAPI但是我看不懂那些,先谢谢大家了,分不多,第一次发帖。。
wince c++ ras
------解决方案--------------------
LZ 可以去看看偶在 CSDN 的 BLOG:
http://blog.csdn.net/91program/article/details/8262374