Beispiel #1
0
 public static IntPtr GetRoot(IntPtr TreeViewHwnd)
 {
     WinFormsUI.Controls.TVITEM lparam = new WinFormsUI.Controls.TVITEM();
     IntPtr hglobal = Marshal.AllocHGlobal(1024);
     lparam.hItem = TreeViewHwnd;
     lparam.mask = 1;
     lparam.pszText = hglobal;
     lparam.cchTextMax = 1024;
     int num = SendMessage(TreeViewHwnd, 4362, new IntPtr(0), lparam);
     Marshal.FreeHGlobal(hglobal);
     return new IntPtr(num);
 }
Beispiel #2
0
        public static IntPtr GetRoot(IntPtr TreeViewHwnd)
        {
            WinFormsUI.Controls.TVITEM lparam = new WinFormsUI.Controls.TVITEM();
            IntPtr hglobal = Marshal.AllocHGlobal(1024);

            lparam.hItem      = TreeViewHwnd;
            lparam.mask       = 1;
            lparam.pszText    = hglobal;
            lparam.cchTextMax = 1024;
            int num = SendMessage(TreeViewHwnd, 4362, new IntPtr(0), lparam);

            Marshal.FreeHGlobal(hglobal);
            return(new IntPtr(num));
        }
Beispiel #3
0
 public static string GetItemText(IntPtr TreeViewHwnd, IntPtr ItemHwnd)
 {
     StringBuilder destination = new StringBuilder(1024);
     int num = GlobalAlloc(0, 1024);
     if (num > 0)
     {
         WinFormsUI.Controls.TVITEM lparam = new WinFormsUI.Controls.TVITEM {
             mask = 1,
             HTreeItem = ItemHwnd.ToInt32(),
             pszText = new IntPtr(num),
             cchTextMax = 1023
         };
         SendMessage(TreeViewHwnd, 4364, IntPtr.Zero, lparam);
         CopyMemory(destination, new IntPtr(num), 1024);
         GlobalFree(new IntPtr(num));
         Marshal.PtrToStringAnsi(lparam.pszText);
     }
     return destination.ToString();
 }
Beispiel #4
0
        public static string GetItemText(IntPtr TreeViewHwnd, IntPtr ItemHwnd)
        {
            StringBuilder destination = new StringBuilder(1024);
            int           num         = GlobalAlloc(0, 1024);

            if (num > 0)
            {
                WinFormsUI.Controls.TVITEM lparam = new WinFormsUI.Controls.TVITEM {
                    mask       = 1,
                    HTreeItem  = ItemHwnd.ToInt32(),
                    pszText    = new IntPtr(num),
                    cchTextMax = 1023
                };
                SendMessage(TreeViewHwnd, 4364, IntPtr.Zero, lparam);
                CopyMemory(destination, new IntPtr(num), 1024);
                GlobalFree(new IntPtr(num));
                Marshal.PtrToStringAnsi(lparam.pszText);
            }
            return(destination.ToString());
        }
Beispiel #5
0
 private static extern int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, WinFormsUI.Controls.TVITEM lparam);