In Ce, if the system does not establish a dial-up network, you need to use code to establish a dial-up network and dial-up to implement the Internet function.
The parameters and dial-up values in the following code are all the configurations of telecom evdo. If you change to GSM or WCDMA, modify it accordingly.
Hrasconn ghrasconn = NULL;/** set serial port baud rate and data bit */bool ctcpclientdlg: setdevcfg (tchar * ptcrasentryname) {hkey HK; unsigned char cdevcfg [684]; tchar tcregaddr [512 + 1]; DWORD * pdweapconndata = NULL; zeromemory (tcregaddr, sizeof (tchar) * (512 + 1); zeromemory (cdevcfg, sizeof (char) * 683); cdevcfg [0] = 0x30; cdevcfg [4] = 0x05; cdevcfg [9] = 0x01; cdevcfg [13] = 0xc2; // baud rate cdevcfg [14] = 0x01; cdevcfg [18] = 0x08; // data bit WSP Rintf (tcregaddr, l "comm \ rasbook \ % s", ptcrasentryname); If (error_success = regopenkeyex (HKEY_CURRENT_USER, tcregaddr, 0, 0, & HK )) {regsetvalueex (HK, l "devcfg", 0, REG_BINARY, (lpbyte) cdevcfg, sizeof (cdevcfg); regsetvalueex (HK, l "eapconndata", 0, REG_BINARY, (lpbyte) pdweapconndata, 0); regflushkey (HKEY_CURRENT_USER); regclosekey (HK); Return true;} return false;} bool restart: createraslink (tchar * ptcrasentryname, Tchar * ptcmodemname) {lprasentry = NULL; DWORD dwrasentrysize = sizeof (rasentry); DWORD dwbuffersize = 0; DWORD dwret = 0; bool Bret = true; if (null = ptcrasentryname | null = ptcmodemname) return false; rasgetentryproperties (null, l "", null, & dwbuffersize, null, null ); if (0 = dwbuffersize) return false; lprasentry = (lprasentry) heapalloc (getprocessheap (), heap_zero_memory, dwbuffersize); If (null = Lprasentry) return false; zeromemory (lprasentry, sizeof (rasentry); lprasentry-> dwsize = dwbuffersize; lprasentry-> dwfoptions = raseo_remotedefagateway gateway; // raseo_previewuserpw pop-up username and password input box // Leo lprasentry-> dwtype = raset_phone; // lprasentry-> dwcountryid = 86; // This member is currently ignored by Windows CE. lprasentry-> dwcountrycode = 86; lstrcpy (lprasentry-> szareacode, l "10"); lstrcpy (lprasentry-> szloc Alphonenumber, l "#777"); lstrcpy (lprasentry-> szdevicetype, rasdt_modem); lstrcpy (lprasentry-> szdevicename, ptcmodemname ); // select the modem name lprasentry-> dwfnetprotocols = rasnp_ip; lprasentry-> dwframingprotocol = rasfp_ppp; dwret = rassetentryproperties (null, delimiter, lprasentry, dwbuffersize, null, 0 ); // create a connection if (0! = Dwret) {Bret = false;} heapfree (getprocessheap (), 0, (lpvoid) lprasentry); Return Bret;} bool ctcpclientdlg: networkdialandparams (tchar * ptcrasentryname) {DWORD dwret = 0; uint I = 0; rasdialparams rdparams; zeromemory (& rdparams, sizeof (rasdialparams); rdparams. dwsize = sizeof (rasdialparams); wcscpy (rdparams. szentryname, ptcrasentryname); // wcscpy (rdparams. szphonenumber, l "#777"); wcscpy (rdparams. szusername, l" Card "); wcscpy (rdparams. szpassword, l "card"); ghrasconn = NULL; dwret = rasdial (null, null, & rdparams, 0 xffffffff, null, & ghrasconn); If (0! = Dwret) {retailmsg (1, (L "rasdial error: % d. \ r \ n", dwret); Return false ;}return true ;}