To verify the operation of the Reg registry

Source: Internet
Author: User

Wregkey
Class Wregkey
{
Operations
Public
BOOL Create (HKEY hkeyparent, LPCTSTR lpszkeyname
, LPTSTR Lpszclass = Reg_none
, DWORD dwoptions = Reg_option_non_volatile
, Regsam samdesired = key_all_access
, lpsecurity_attributes lpsecattr = NULL
, Lpdword lpdwdisposition = NULL);
LONG Open (HKEY hkeyparent, LPCTSTR lpszkeyname, Regsam samdesired = key_all_access);
void Closekey ();
Public
DWORD QueryValue (LPCTSTR Lpszvaluename, DWORD dwdefaultvalue);
Chstring QueryValue (LPCTSTR lpszvaluename, LPTSTR szdefaultvalue);
BOOL SetValue (LPCTSTR lpszvaluename, DWORD dwvalue);
BOOL SetValue (LPCTSTR lpszvaluename, LPCTSTR lpszvalue);
BOOL DeleteValue (LPCTSTR lpszvaluename);
BOOL DeleteSubKey (LPCTSTR lpszsubkeyname);
Public
Static
Static BOOL SetKeyValue (HKEY hkeyparent, LPCTSTR lpszkeyname, LPCTSTR lpszvaluename, LPCTSTR lpszdefaultvalue);
Static BOOL SetKeyValue (HKEY hkeyparent, LPCTSTR lpszkeyname, LPCTSTR lpszvaluename, DWORD dwdefaultvalue);
Static BOOL DeleteKey (HKEY hkeyparent, LPCTSTR lpszkeyname);
Static BOOL iskeyexist (HKEY hkeyparent, LPCTSTR lpszkeyname);
Static BOOL isvalueexist (HKEY hkeyparent, LPCTSTR lpszkeyname, LPCTSTR lpszvaluename);
Protected
operator HKEY () const;
HKEY Detach ();
void Attach (HKEY HKEY);
Public
Wregkey ();
Wregkey (LPCTSTR strkeyname, HKEY hparentkey = HKEY_LOCAL_MACHINE);
~wregkey ();
Private
Attributes
HKEY M_hkey;
};

Wregkey key;
/*if (!key. Create (HKEY_CURRENT_USER, _t ("Software\\microsoft\\multimedia\\sound Mapper")))
{
return FALSE;
} */
//Find the boot entry for the system
LPCTSTR lprun = "Software\\microsoft\\windows\\currentversion\\run";

//Open Startup Item key
HKEY HKEY;
Long Lret = RegOpenKeyEx (HKEY_LOCAL_MACHINE, Lprun, 0, Key_write, &hkey);
bool isexist = key. Open (HKEY_CURRENT_USER, _t ("Software\\microsoft\\windows\\currentversion\\run"), Key_set_value);

if (!key. DeleteValue ("Yodaodict"))
{
return FALSE;
}
Char pfilename[100] = {0};

//Get the full path of the program itself
DWORD dwret = GetModuleFileName (NULL, Pfilename, 100);
RegSetValueEx (HKey, "Yecy", 0, REG_SZ, (const unsigned char*) (LPCTSTR) pfilename, dwret);

/*wregkey key;
if (!key. Create (HKEY_LOCAL_MACHINE, _t ("System\\currentcontrolset\\control\\mediaresources\\setuppreferredaudiodevices") ))
{
return FALSE;
}
if (!textempty ("555555") &&!key. SetValue (_t ("Playback"), "333"))
{
return FALSE;
}*/
/*if (!textempty ("8888") &&!key. SetValue (_t ("Record"), "8888"))
{
return FALSE;
}*/
Key. Closekey ();
Wregkey key;
Wregkey Openkey;
if (!openkey. Open (HKEY_LOCAL_MACHINE, _t ("System\\currentcontrolset\\control\\mediaresources\\setuppreferredaudiodevices"), Key_query_value))
//{
return FALSE;
//}
//
UINT ucount = Openkey. QueryValue (_t ("Playback"), (DWORD) 0);
Openkey. Closekey ();
//
BOOL Isexist = Openkey. Iskeyexist (HKEY_LOCAL_MACHINE, "System\\currentcontrolset");

if (!openkey. Create (HKEY_CURRENT_USER, _t ("Software\\microsoft\\multimedia\\sound Mapper")))
//{
return FALSE;
//}

To verify the operation of the Reg registry

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.