// generic method to retrieve info about tree view item
        // NOTE: this method should not be used to retrieve a text
        // instead use GetItemText
        private static bool GetItem (IntPtr hwnd, IntPtr item, int mask, out NativeMethods.TVITEM treeItem)
        {
            treeItem = new NativeMethods.TVITEM ();
            treeItem.Init (item);
            treeItem.mask = (uint) mask;

            return XSendMessage.GetItem(hwnd, ref treeItem);
        }
        private static string GetItemText(IntPtr hwnd, IntPtr item)
        {
            NativeMethods.TVITEM treeItem = new NativeMethods.TVITEM();
            treeItem.Init(item);
            treeItem.mask = NativeMethods.TVIF_TEXT;
            treeItem.cchTextMax = Misc.MaxLengthNameProperty;

            return XSendMessage.GetItemText(hwnd, treeItem);
        }
        // set the check state for the specified item
        private unsafe static bool SetCheckState (IntPtr hwnd, IntPtr item, bool check)
        {
            uint val = (check) ? 2U : 1U;

            val <<= 12;

            NativeMethods.TVITEM treeItem = new NativeMethods.TVITEM ();
            treeItem.Init (item);
            treeItem.mask = NativeMethods.TVIF_STATE;
            treeItem.state = val;
            treeItem.stateMask = NativeMethods.TVIS_STATEIMAGEMASK;

            return XSendMessage.SetItem(hwnd, treeItem);
        }