Internet option to add a trusted site

Source: Internet
Author: User

Print? // Two Trust sites m_ListBox.AddString ("Hangzhou"); m_ListBox.AddString ("172.100.60.18") are added to ListBox; // two Trust sites m_ListBox.AddString ("172.100.60.8") are added to ListBox "); m_ListBox.AddString ("172.100.60.18"); [cpp] BOOL CIEDlg: AddSite () {for (int I = 0; I <m_ListBox.GetCount (); I ++) {CString Site; m_ListBox.GetText (I, Site); for (int j = 1; j <100; j ++) {// Add a new HKEY hKey; DWORD lp_disp; // open the Registry CString index; index. format ("% D", j); CString m_path = "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ ZoneMap \ Ranges \ Range" + index; LONG lnRes =: RegCreateKeyEx (HKEY_CURRENT_USER, m_path, // subdirectory path 0L, // 0 NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, & hKey, & lp_disp ); // if an existing or failed operation is enabled, continue; if (lp_disp = REG_OPENED_EXISTING_KEY | lnRes! = ERROR_SUCCESS) continue; LPBYTE Data = new BYTE [4]; int _ Data [4] = {2, 0, 0}; for (int I = 0; I <4; I ++) {* (Data + I) = _ Data [I];} lnRes = RegSetValueEx (hKey, "*", 0, REG_DWORD, Data, REG_DWORD ); unsigned char site_Data [30]; lstrcpy (char *) site_Data, LPCTSTR (Site); lnRes = RegSetValueEx (hKey, ": Range", 0, REG_SZ, site_Data, Site. getLength () + 1); // if a URL is successfully added, break; if (ERROR_SUCCESS = lnRes) Break; else AfxMessageBox ("failed") ;}return true;} BOOL CIEDlg: AddSite () {for (int I = 0; I <m_ListBox.GetCount (); I ++) {CString Site; m_ListBox.GetText (I, Site); for (int j = 1; j <100; j ++) {// Add a new HKEY hKey; DWORD lp_disp; // open the Registry CString index; index. format ("% d", j ); CString m_path = "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ ZoneMap \ Ranges \ Range" + index; LONG lnRes =: RegCreateKey Ex (HKEY_CURRENT_USER, m_path, // subdirectory path 0L, // 0 NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, & hKey, & lp_disp ); // if an existing or failed operation is enabled, continue; if (lp_disp = REG_OPENED_EXISTING_KEY | lnRes! = ERROR_SUCCESS) continue; LPBYTE Data = new BYTE [4]; int _ Data [4] = {2, 0, 0}; for (int I = 0; I <4; I ++) {* (Data + I) = _ Data [I];} lnRes = RegSetValueEx (hKey, "*", 0, REG_DWORD, Data, REG_DWORD ); unsigned char site_Data [30]; lstrcpy (char *) site_Data, LPCTSTR (Site); lnRes = RegSetValueEx (hKey, ": Range", 0, REG_SZ, site_Data, Site. getLength () + 1); // if a URL is successfully added, break; if (ERROR_SUCCESS = lnRes) break; www.2cto. comelseAfxMessageBox ("failed") ;}} return true ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.