当前位置: 首页>>代码示例>>C#>>正文


C# NativeMethods.GetType方法代码示例

本文整理汇总了C#中NativeMethods.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# NativeMethods.GetType方法的具体用法?C# NativeMethods.GetType怎么用?C# NativeMethods.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NativeMethods的用法示例。


在下文中一共展示了NativeMethods.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetItemPosition

        // get top-left point of the listview item
        static private unsafe bool GetItemPosition (IntPtr hwnd, int item, out NativeMethods.Win32Point pt)
        {
            pt.x = 0;
            pt.y = 0;

            fixed (int * location = &(pt.x))
            {
                if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETITEMPOSITION, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(pt.GetType())))
                {
                    return Misc.MapWindowPoints(hwnd, IntPtr.Zero, ref pt, 1);
                }

                return false;
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:16,代码来源:WindowsListView.cs

示例2: SetItem

        // This overload method is used to set TreeView Item data.
        internal static unsafe bool SetItem(IntPtr hwnd, NativeMethods.TVITEM item)
        {
            ProcessorTypes localBitness;
            ProcessorTypes remoteBitness;
            GetProcessTypes(hwnd, out localBitness, out remoteBitness);

            if (localBitness == remoteBitness)
            {
                return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType()));
            }
            else if (remoteBitness == ProcessorTypes.Processor32Bit)
            {
                TVITEM_32 item32 = new TVITEM_32(item);

                return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType()));
            }
            else if (remoteBitness == ProcessorTypes.Processor64Bit)
            {
                TVITEM_64 item64 = new TVITEM_64(item);

                return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()));
            }
            return false;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:CommonXSendMessage.cs

示例3: GetSubItemRect

        // gets rectangle of the subitem.
        // This method is inteded to be used with the LVS_REPORT lv
        static public unsafe bool GetSubItemRect (IntPtr hwnd, int item, int subItem, int lvir, out NativeMethods.Win32Rect itemRectangle)
        {
            itemRectangle = NativeMethods.Win32Rect.Empty;
            itemRectangle.left = lvir;
            itemRectangle.top = subItem;

            fixed (int * location = &(itemRectangle.left))
            {
                if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETSUBITEMRECT, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(itemRectangle.GetType())))
                {
                    return Misc.MapWindowPoints(hwnd, IntPtr.Zero, ref itemRectangle, 2);
                }

                return false;
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:18,代码来源:WindowsListView.cs

示例4: GetItem

        //------------------------------------------------------
        //
        //  SysHeader Control Methods that support cross process / cross bitness
        //
        //------------------------------------------------------

        #region SysHeader Control Methods

        // This overload method is used to get SysHeader Item data.
        internal static unsafe bool GetItem(IntPtr hwnd, int index, ref NativeMethods.HDITEM item)
        {
            ProcessorTypes localBitness;
            ProcessorTypes remoteBitness;
            GetProcessTypes(hwnd, out localBitness, out remoteBitness);

            if (localBitness == remoteBitness)
            {
                fixed (NativeMethods.HDITEM* pItem = &item)
                {
                    return XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType()));
                }
            }
            else if (remoteBitness == ProcessorTypes.Processor32Bit)
            {
                HDITEM_32 item32 = new HDITEM_32(item);

                bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()));

                if (result)
                {
                    item = (NativeMethods.HDITEM)item32;
                }

                return result;
            }
            else if (remoteBitness == ProcessorTypes.Processor64Bit)
            {
                HDITEM_64 item64 = new HDITEM_64(item);

                bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()));

                if (result)
                {
                    item = (NativeMethods.HDITEM)item64;
                }

                return result;
            }
            return false;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:50,代码来源:CommonXSendMessage.cs

示例5: GetItemText

        // This overload method is used to get SysHeader Item text.
        internal static unsafe string GetItemText(IntPtr hwnd, int index, NativeMethods.HDITEM item)
        {
            ProcessorTypes localBitness;
            ProcessorTypes remoteBitness;
            GetProcessTypes(hwnd, out localBitness, out remoteBitness);

            if (localBitness == remoteBitness)
            {
                return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax);
            }
            else if (remoteBitness == ProcessorTypes.Processor32Bit)
            {
                HDITEM_32 item32 = new HDITEM_32(item);

                return GetTextWithinStructureRemoteBitness(
                          hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item32),
                          Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), item32.cchTextMax,
                          remoteBitness, false);
            }
            else if (remoteBitness == ProcessorTypes.Processor64Bit)
            {
                HDITEM_64 item64 = new HDITEM_64(item);

                return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax);
            }
            return "";
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:28,代码来源:CommonXSendMessage.cs

示例6: GetGroupInfo

        // This overload method is used to get ListView group data.
        internal static unsafe bool GetGroupInfo(IntPtr hwnd, ref NativeMethods.LVGROUP_V6  group)
        {
            ProcessorTypes localBitness;
            ProcessorTypes remoteBitness;
            GetProcessTypes(hwnd, out localBitness, out remoteBitness);

            if (localBitness == remoteBitness)
            {
                int result = 0;
                fixed (NativeMethods.LVGROUP_V6* pGroup = &group)
                {
                    result = XSendGetIndex(hwnd, NativeMethods.LVM_GETGROUPINFO,
                                    new IntPtr(group.iGroupID), new IntPtr(pGroup), Marshal.SizeOf(group.GetType()));
                }
                if (result == group.iGroupID)
                {
                    return true;
                }
            }
            else if (remoteBitness == ProcessorTypes.Processor32Bit)
            {
                LVGROUP_V6_32 group32 = new LVGROUP_V6_32(group);
                int result = XSendGetIndex(hwnd, NativeMethods.LVM_GETGROUPINFO,
                                new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType()));
                if (result == group32.iGroupID)
                {
                    group = (NativeMethods.LVGROUP_V6)group32;
                    return true;
                }
            }
            else if (remoteBitness == ProcessorTypes.Processor64Bit)
            {
                LVGROUP_V6_64 group64 = new LVGROUP_V6_64(group);
                int result = XSendGetIndex(hwnd, NativeMethods.LVM_GETGROUPINFO,
                                new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType()));
                if (result == group64.iGroupID)
                {
                    group = (NativeMethods.LVGROUP_V6)group64;
                    return true;
                }
            }
            return false;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:44,代码来源:CommonXSendMessage.cs

示例7: SetGroupInfo

        // This overload method is used to set ListView group data.
        internal static unsafe bool SetGroupInfo(IntPtr hwnd, NativeMethods.LVGROUP group)
        {
            ProcessorTypes localBitness;
            ProcessorTypes remoteBitness;
            GetProcessTypes(hwnd, out localBitness, out remoteBitness);

            if (localBitness == remoteBitness)
            {
                int result = XSendGetIndex(hwnd, NativeMethods.LVM_SETGROUPINFO,
                                new IntPtr(group.iGroupID), new IntPtr(&group), Marshal.SizeOf(group.GetType()));
                return (result == group.iGroupID);
            }
            else if (remoteBitness == ProcessorTypes.Processor32Bit)
            {
                LVGROUP_32 group32 = new LVGROUP_32(group);
                int result = XSendGetIndex(hwnd, NativeMethods.LVM_SETGROUPINFO,
                                new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType()));
                return (result == group.iGroupID);
            }
            else if (remoteBitness == ProcessorTypes.Processor64Bit)
            {
                LVGROUP_64 group64 = new LVGROUP_64(group);
                int result = XSendGetIndex(hwnd, NativeMethods.LVM_SETGROUPINFO,
                                new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType()));
                return (result == group.iGroupID);
            }
            return false;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:29,代码来源:CommonXSendMessage.cs


注:本文中的NativeMethods.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。