Does this SubKey Exist ?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2008
Posts: 122
Reputation: Liszt is an unknown quantity at this point 
Solved Threads: 6
Liszt Liszt is offline Offline
Junior Poster

Does this SubKey Exist ?

 
0
  #1
May 9th, 2009
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'

  1. Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");
  2.  
  3. if( subKey1 != nullptr ) //Exists ?
  4. {
  5. //do something
  6. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 122
Reputation: Liszt is an unknown quantity at this point 
Solved Threads: 6
Liszt Liszt is offline Offline
Junior Poster

Re: Does this SubKey Exist ?

 
0
  #2
May 10th, 2009
This is working, found a solution.
  1. RegistryKey^ rk;
  2. rk = Registry::ClassesRoot->OpenSubKey("abc1\\asd123", true);
  3.  
  4. if (rk == nullptr)//key exist
  5. {
  6. //Do Not Exists !!!
  7. }
  8.  
  9. if (rk != nullptr) //key doesn't exist
  10. {
  11. //Do Exists !!!
  12. }


Originally Posted by Liszt View Post
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'

  1. Microsoft::Win32::RegistryKey subKey1 = Microsoft::Win32::Registry::ClassesRoot->OpenSubKey("one\\two");
  2.  
  3. if( subKey1 != nullptr ) //Exists ?
  4. {
  5. //do something
  6. }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 456 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC