Myspace Backgrounds -> Mini-sites

hex registry convert string

Programming resources answers tools.

Q: How do you convert the hex representation of a ... into a string?

A: There are two common scenarios:

  • convert a string containing the hex representation of some built-in type variable.

    Examples are an int or a float.

  • convert the hex representation of every byte from a string.
template <class T>

CString VariableToHexString(T t)
{
  CString ret, tmp;

  for(int i = sizeof(T)-1; i >= 0; i--)
  {
    unsigned char c = reinterpret_cast(&t)[i];
    tmp.Format(" %02hX", c);
    ret+=tmp;
  }

    return ret;
}

//...
// Following call
AfxMessageBox(VariableToHexString<int>(12345678), MB_OK, 0);


// produces a message box containing "00 BC 61 4E"


String to HexString

CString StringToHexString(CString cs)
{
  CString ret, tmp;

  for(int i=0; i < cs.GetLength(); i++)
  {
    unsigned char c = cs[i];
    tmp.Format(" %02hX", c);
    ret+=tmp;
  }

  return ret;
}

// Following call
  AfxMessageBox(StringToHexString("Hello"), MB_OK, 0);

// produces a message box containing "48 65 6C 6C 6F"
A registry is a database used to store settings, and options, for the operating system. This is true for Microsoft Windows 32-bit versions. It contains information, and settings, for all the hardware, software, users, and preferences of the PC.

"Control Panel" settings, file associations, system policies, or installed software are systemwide changes. They are reflected, and stored, in the registry.

On Windows 9x computers, older installations often have a multitude of registry additions. While it is a universally available resource, a large size impacts system performance. hex registry convert string

To edit the registry, in Microsoft Windows, use regedit.exe in the Windows directory. WARNING: Improer editing of the registry causes irreversible damage. Be sure what you are doing.

Many optimization, and "hacking", tools are available to modify the registry. However, it is better to use one of the (many) registry cleaners available.

hex registry convert string

A simple implementation, of the current registry tool, appeared in Windows 3.x. It was called the "Registration Info Editor". It was basically a file extension database. It was used to associate files, when double clicked. hex registry convert string

hex registry convert string