本文整理汇总了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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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 "";
}
示例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;
}
示例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;
}