How to find the software installation path through the registration list

Source: Internet
Author: User

The following uses QQ as an example:

# Include <iostream> # include <windows. h> using namespace STD; # define rtn_error 13int main (void) {# define my_bufsize 132 // arbitrary initial value. // dynamic allocation will be used. hkey; tchar szproducttype [my_bufsize]; DWORD dwbuflen = my_bufsize; long LRET; // open the registry below. Other operations can be performed only after the registry is opened. LRET = regopenkeyex (HKEY_LOCAL_MACHINE, // text ("SOFTWARE \ Tencent \ qq2009") of the Root Key to be opened, // the subkey 0 to be opened, // This must be 0 Key_query_value, // specify the open mode, which is read & hkey); // return the handle if (LRET! = Error_success) // determines whether the server is successfully opened. Return 1; // The following LRET = regqueryvalueex (hkey, // The handle text ("Install") returned when the registry is opened "), // The name to be queried. The QQ installation directory record is null. // It must be null or 0 null, (lpbyte) szproducttype, // put what we want here & dwbuflen); If (LRET! = Error_success) // determines whether the query is successful. Return 1; regclosekey (hkey); cout <(char *) szproducttype; strcat (szproducttype, "\ bin \ QQ. EXE "); winexec (szproducttype, sw_show );}

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.