title: C++ Read a Registry String Value in char*
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6222583/how-to-compare-strings">How to compare strings</a>  </p>
  </blockquote>
  
  
  
  <p><br>I want to Compare to registry string values and if they were the same an messagebox appears
  <br>Currently I'm using this functions , It returns the value correctly but whenever I want to compare them, The compare result is always wrong
  <br></p>
  
  <pre><code>char* GetRegistry(char* StringName)
  {
  DWORD dwType = REG_SZ;
  HKEY hKey = 0;
  char value[1024];
  DWORD value_length = 1024;
  const char* subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\MCI\\Player";
  RegOpenKey(HKEY_LOCAL_MACHINE,subkey,&amp;hKey);
  RegQueryValueEx(hKey, StringName, NULL, &amp;dwType, (LPBYTE)&amp;value, &amp;value_length);
  return  value;
  }
  </code></pre>
  
  <p><BR>I use this to compare them</p>
  
  <pre><code>if (GetRegistry("First") == GetRegistry("Second"))
  {
  MessageBox(NULL,":|",":|",1);
  }
  </code></pre>
  
  <p><br> But the MessageBox appears how ever The values are different</p>
  
  <p><br>Any help is appreciated.</p>