try { depth = Integer.parseInt (lpData.toString (0, lpData.strlen ())); } catch (NumberFormatException e) {}
TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof); result = OS.RegQueryValueEx (phkResult [0], buffer2, 0, null, lpData, lpcbData); if (result == 0) { try { depth = Integer.parseInt (lpData.toString (0, lpData.strlen ())); } catch (NumberFormatException e) {} }
public int getIconDepth () {	checkDevice ();	if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {		if (getDepth () >= 24) return 32;	}	/* Use the character encoding for the default locale */	TCHAR buffer1 = new TCHAR (0, "Control Panel\\Desktop\\WindowMetrics", true); //$NON-NLS-1$	int [] phkResult = new int [1];	int result = OS.RegOpenKeyEx (OS.HKEY_CURRENT_USER, buffer1, 0, OS.KEY_READ, phkResult);	if (result != 0) return 4;	int depth = 4;	int [] lpcbData = {128};		/* Use the character encoding for the default locale */	TCHAR lpData = new TCHAR (0, lpcbData [0]);	TCHAR buffer2 = new TCHAR (0, "Shell Icon BPP", true); //$NON-NLS-1$		result = OS.RegQueryValueEx (phkResult [0], buffer2, 0, null, lpData, lpcbData);	if (result == 0) {		try {			depth = Integer.parseInt (lpData.toString (0, lpData.strlen ()));		} catch (NumberFormatException e) {}	}	OS.RegCloseKey (phkResult [0]);	return depth;}