Drawing simple graphics under Windows console

Source: Internet
Author: User

The sample code will be in the registry location: hkey_current_user\software\ read-write key value

BOOL Licensemanage::openregkey (hkey& hretkey) {if (error_success = = RegOpenKey (HKEY_CURRENT_USER, "Software",    &hretkey)) {return true; } return false;}    BOOL Licensemanage::createregkey (String strSubKey, String strValueName, String strvalue) {HKEY HKEY;    HKEY Hsubkey;        if (Openregkey (HKey)) {//Create key RegCreateKey (Hkey,strsubkey.c_str (), &hsubkey); Set the key value if (error_success! = RegSetValueEx (Hsubkey,strvaluename.c_str (), 0,REG_SZ, (CONST BYTE *) strvalue.c_str (), str        Value.size () +1) {return false; } regclosekey (HKey);    Close registry return true; } return false;}    BOOL Licensemanage::queryregkey (String strSubKey, String strValueName, string& strvalue) {DWORD dwtype= 1;//define data type    DWORD Dwlen = MAX_PATH;    Char Data[max_path];    memset (data,0,sizeof (data));    HKEY HKEY;    HKEY Hsubkey;        if (Openregkey (HKey)) {string strtempkey = "software\\" +strsubkey; if (ErroR_success = = RegOpenKey (Hkey_current_user,strtempkey.c_str (), &hsubkey)) {if (error_success = = RegQ Ueryvalueex (Hsubkey,strvaluename.c_str (), 0,&dwtype, (LPBYTE) Data,&dwlen)) {strvalue = da                Ta RegCloseKey (HKey);            Close registry return true; }} RegCloseKey (HKey); Close the registry} return false;    BOOL Licensemanage::setregkey (String strSubKey, String strValueName, String strvalue) {HKEY HKEY;    HKEY Hsubkey;        if (Openregkey (HKey)) {string strtempkey = "software\\" +strsubkey;  if (error_success = = RegOpenKey (Hkey_current_user,strtempkey.c_str (), &hsubkey)) {if (error_success                = = RegSetValueEx (Hsubkey,strvaluename.c_str (), 0,REG_SZ, (LPBYTE) strvalue.c_str (), Strvalue.size ())) { RegCloseKey (HKey);            Close registry return true; }} RegCloseKey (HKey); Close the registry} return false;


Drawing simple graphics under Windows console

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.