How would it be possible to check if a subKey exist in the Classes root in Registry Editor. My attemt is like follows but my compiler doesn´t like it.

'Microsoft::Win32::RegistryKey' : class does not have a copy-constructor
no conversion from 'nullptr' to 'Microsoft::Win32::RegistryKey'

Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");

	 if( subKey1 != nullptr ) //Exists ?
	 {
                         //do something
	 }

This is working, found a solution.

RegistryKey^ rk;
rk = Registry::ClassesRoot->OpenSubKey("abc1\\asd123", true);

if (rk == nullptr)//key exist		
{
	 //Do Not Exists !!!
}

if (rk != nullptr) //key doesn't exist		
{
	 //Do Exists !!!
}

How would it be possible to check if a subKey exist in the Classes root in Registry Editor. My attemt is like follows but my compiler doesn´t like it.

'Microsoft::Win32::RegistryKey' : class does not have a copy-constructor
no conversion from 'nullptr' to 'Microsoft::Win32::RegistryKey'

Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");

	 if( subKey1 != nullptr ) //Exists ?
	 {
                         //do something
	 }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.