VC Read Registry Get Setup program

Source: Internet
Author: User

In Windows systems, Setup can be obtained in registry HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall, and XP, Vista, Win7 And Win8 are all the same

Open Registry command: Regedit, expand the registry path above, and the installer list is as follows:

To obtain a list of system setup programs:

Get System Installer List BOOL Cmylistctrltestdlg::allregkey (hkey hkey, LPCTSTR szdeskeyitem) {hkey hsubkey;
     DWORD dwindex = 0;      
     Long lresult;      

     int i = 1;      LRESULT = RegOpenKeyEx (hkey, Szdeskeyitem, 0, Key_read, &hsubkey);
         Open the registry if (Error_success = = lresult) {TCHAR szkeyname[256] = {0};

         DWORD cbname = 256*sizeof (TCHAR);      LRESULT = RegEnumKeyEx (Hsubkey, Dwindex, Szkeyname, &cbname, 0, NULL, NULL, NULL); Get field while (lresult = error_success && lresult!= error_more_data) {OutputDebugString (sz


             KEYNAME);
             CString str; Str.

             Format (_t ("%d"), I);        i = M_mylist.insertitem (i, str);


             Insert to list control to display M_mylist.setitemtext (i,1,szkeyname);          Dwindex = dwindex + 1;      
             Change dwindex, loop get down field cbname = 256*sizeof (TCHAR); LRESULT = RegEnumKeyEx (Hsubkey, Dwindex, Szkeyname, &Amp;cbname, 0, NULL, NULL, NULL);      

         i++;       } regclosekey (Hsubkey);
     Close registry return TRUE;
     } regclosekey (Hsubkey);      
 return FALSE; }

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.