本文整理汇总了Python中ctypes.wintypes.WCHAR属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.WCHAR属性的具体用法?Python wintypes.WCHAR怎么用?Python wintypes.WCHAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ctypes.wintypes
的用法示例。
在下文中一共展示了wintypes.WCHAR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import WCHAR [as 别名]
def __init__(self, filter_in, events):
struct_size = len(events) * ct.sizeof(wt.USHORT) + ct.sizeof(EVENT_FILTER_EVENT_ID)
self._buf = (ct.c_char * struct_size)()
self._props = ct.cast(ct.pointer(self._buf), ct.POINTER(EVENT_FILTER_EVENT_ID))
self._props.contents.FilterIn = filter_in
self._props.contents.Reserved = 0
self._props.contents.Count = len(events)
for i in range(len(events)):
ct.memmove(ct.cast(ct.addressof(self._buf) + ct.sizeof(EVENT_FILTER_EVENT_ID) + (ct.sizeof(wt.WCHAR) * i),
ct.c_void_p),
ct.byref(wt.USHORT(events[i])),
ct.sizeof(wt.WCHAR))
示例2: _get_cch_referenced_domain_name
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import WCHAR [as 别名]
def _get_cch_referenced_domain_name(domain_name):
return wintypes.DWORD(
ctypes.sizeof(domain_name) // ctypes.sizeof(wintypes.WCHAR))
示例3: PrintName
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import WCHAR [as 别名]
def PrintName(self):
arrayt = WCHAR * (self.PrintNameLength // 2)
offset = type(self).PathBuffer.offset + self.PrintNameOffset
return arrayt.from_address(addressof(self) + offset).value
示例4: _get_physical_monitors_from_hmonitor
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import WCHAR [as 别名]
def _get_physical_monitors_from_hmonitor(hmonitor: wintypes.HMONITOR) -> list:
"""
Retrieves the physical monitors associated with an HMONITOR monitor handle
https://msdn.microsoft.com/en-us/library/vs/alm/dd692950(v=vs.85).aspx
BOOL GetPhysicalMonitorsFromHMONITOR(
_In_ HMONITOR hMonitor,
_In_ DWORD dwPhysicalMonitorArraySize,
_Out_ LPPHYSICAL_MONITOR pPhysicalMonitorArray
);
Retrieves the number of physical monitors associated with an HMONITOR monitor handle.
Call this function before calling GetPhysicalMonitorsFromHMONITOR.
https://msdn.microsoft.com/en-us/library/dd692948(v=vs.85).aspx
BOOL GetNumberOfPhysicalMonitorsFromHMONITOR(
_In_ HMONITOR hMonitor,
_Out_ LPDWORD pdwNumberOfPhysicalMonitors
);
:param hmonitor:
:return:
"""
class _PhysicalMonitorStructure(ctypes.Structure):
"""
PHYSICAL_MONITOR Structure.
https://msdn.microsoft.com/en-us/library/vs/alm/dd692967(v=vs.85).aspx
typedef struct _PHYSICAL_MONITOR {
HANDLE hPhysicalMonitor;
WCHAR szPhysicalMonitorDescription[PHYSICAL_MONITOR_DESCRIPTION_SIZE];
} PHYSICAL_MONITOR, *LPPHYSICAL_MONITOR;
PHYSICAL_MONITOR_DESCRIPTION_SIZE = 128
"""
_fields_ = [
("hPhysicalMonitor", wintypes.HANDLE),
("szPhysicalMonitorDescription", wintypes.WCHAR * 128)
]
# Retrieves the number of physical monitors
phy_monitor_number = wintypes.DWORD()
api_call_get_number = ctypes.windll.Dxva2.GetNumberOfPhysicalMonitorsFromHMONITOR
if not api_call_get_number(hmonitor, ctypes.byref(phy_monitor_number)):
_LOGGER.error(ctypes.WinError())
return []
# Retrieves the physical monitors
api_call_get_monitor = ctypes.windll.Dxva2.GetPhysicalMonitorsFromHMONITOR
# create array
phy_monitor_array = (_PhysicalMonitorStructure * phy_monitor_number.value)()
if not api_call_get_monitor(hmonitor, phy_monitor_number, phy_monitor_array):
_LOGGER.error(ctypes.WinError())
return []
return list(phy_monitor_array)