本文整理汇总了Python中ctypes.wintypes.UINT属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.UINT属性的具体用法?Python wintypes.UINT怎么用?Python wintypes.UINT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ctypes.wintypes
的用法示例。
在下文中一共展示了wintypes.UINT属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SafeArrayCreate
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def SafeArrayCreate(vt, dims, bound):
prototype = ctypes.WINFUNCTYPE(
ctypes.POINTER(SAFEARRAY),
VARTYPE,
wintypes.UINT,
ctypes.POINTER(SAFEARRAYBOUND)
)
paramflags = (
(_In_, 'vt'),
(_In_, 'cDims'),
(_In_, 'rgsabound'),
)
_SafeArrayCreate = prototype(('SafeArrayCreate', oleaut32), paramflags)
return _SafeArrayCreate(vt, dims, bound)
示例2: _set_argtypes
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def _set_argtypes(self):
''' Functions arguments. '''
self.MONITORENUMPROC = WINFUNCTYPE(INT, DWORD, DWORD, POINTER(RECT),
DOUBLE)
windll.user32.GetSystemMetrics.argtypes = [INT]
windll.user32.EnumDisplayMonitors.argtypes = [HDC, c_void_p,
self.MONITORENUMPROC,
LPARAM]
windll.user32.GetWindowDC.argtypes = [HWND]
windll.gdi32.CreateCompatibleDC.argtypes = [HDC]
windll.gdi32.CreateCompatibleBitmap.argtypes = [HDC, INT, INT]
windll.gdi32.SelectObject.argtypes = [HDC, HGDIOBJ]
windll.gdi32.BitBlt.argtypes = [HDC, INT, INT, INT, INT, HDC, INT, INT,
DWORD]
windll.gdi32.DeleteObject.argtypes = [HGDIOBJ]
windll.gdi32.GetDIBits.argtypes = [HDC, HBITMAP, UINT, UINT, c_void_p,
POINTER(BITMAPINFO), UINT]
示例3: SysStringLen
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def SysStringLen(bstr):
prototype = ctypes.WINFUNCTYPE(
wintypes.UINT,
BSTR
)
paramflags = (
(_In_, 'pbstr'),
)
_SysStringLen = prototype(('SysStringLen', oleaut32), paramflags)
return _SysStringLen(bstr)
示例4: __init__
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def __init__(self, tzres_loc='tzres.dll'):
# Load the user32 DLL so we can load strings from tzres
user32 = ctypes.WinDLL('user32')
# Specify the LoadStringW function
user32.LoadStringW.argtypes = (wintypes.HINSTANCE,
wintypes.UINT,
wintypes.LPWSTR,
ctypes.c_int)
self.LoadStringW = user32.LoadStringW
self._tzres = ctypes.WinDLL(tzres_loc)
self.tzres_loc = tzres_loc
示例5: __init__
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def __init__(self, tzres_loc='tzres.dll'):
# Load the user32 DLL so we can load strings from tzres
user32 = ctypes.WinDLL('user32')
# Specify the LoadStringW function
user32.LoadStringW.argtypes = (wintypes.HINSTANCE,
wintypes.UINT,
wintypes.LPWSTR,
ctypes.c_int)
self.LoadStringW = user32.LoadStringW
self._tzres = ctypes.WinDLL(tzres_loc)
self.tzres_loc = tzres_loc
示例6: wide2utf8
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def wide2utf8(self, fn):
"""Take a unicode file name string and encode it to a multibyte string
that Windows can use to represent file names (CP65001, UTF-8)
http://msdn.microsoft.com/en-us/library/windows/desktop/dd374130"""
from ctypes import wintypes
_CP_UTF8 = 65001
_CP_ACP = 0 # ANSI
_LPBOOL = POINTER(c_long)
_wideCharToMultiByte = windll.kernel32.WideCharToMultiByte
_wideCharToMultiByte.restype = c_int
_wideCharToMultiByte.argtypes = [wintypes.UINT, wintypes.DWORD,
wintypes.LPCWSTR, c_int,
wintypes.LPSTR, c_int,
wintypes.LPCSTR, _LPBOOL]
codePage = _CP_UTF8
dwFlags = 0
lpWideCharStr = fn
cchWideChar = len(fn)
lpMultiByteStr = None
cbMultiByte = 0 # zero requests size
lpDefaultChar = None
lpUsedDefaultChar = None
# get size
mbcssize = _wideCharToMultiByte(
codePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr,
cbMultiByte, lpDefaultChar, lpUsedDefaultChar)
if mbcssize <= 0:
raise WinError(mbcssize)
lpMultiByteStr = create_string_buffer(mbcssize)
# convert
retcode = _wideCharToMultiByte(
codePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr,
mbcssize, lpDefaultChar, lpUsedDefaultChar)
if retcode <= 0:
raise WinError(retcode)
return lpMultiByteStr.value
示例7: get_system_wow_64_dir_a
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def get_system_wow_64_dir_a(string_buffer: wintypes.LPSTR, size: wintypes.UINT) -> wintypes.UINT:
pass
示例8: _callback
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def _callback(self, wType, uFmt, hConv, hsz1, hsz2, hDdeData, dwData1, dwData2):
"""DdeCallback callback function for processing Dynamic Data Exchange (DDE)
transactions sent by DDEML in response to DDE events
Parameters
----------
wType : transaction type (UINT)
uFmt : clipboard data format (UINT)
hConv : handle to conversation (HCONV)
hsz1 : handle to string (HSZ)
hsz2 : handle to string (HSZ)
hDDedata : handle to global memory object (HDDEDATA)
dwData1 : transaction-specific data (DWORD)
dwData2 : transaction-specific data (DWORD)
Returns
-------
ret : specific to the type of transaction (HDDEDATA)
"""
if wType == XTYP_ADVDATA: # value of the data item has changed [hsz1 = topic; hsz2 = item; hDdeData = data]
dwSize = DWORD(0)
pData = DDE.AccessData(hDdeData, byref(dwSize))
if pData:
topic = create_string_buffer(b'\000' * 128)
item = create_string_buffer(b'\000' * 128)
DDE.QueryString(self._idInst, hsz1, topic, 128, CP_WINANSI)
DDE.QueryString(self._idInst, hsz2, item, 128, CP_WINANSI)
self.callback(pData, topic.value, item.value)
DDE.UnaccessData(hDdeData)
return DDE_FACK
else:
print("Error: AccessData returned NULL! (err = %s)"% (hex(DDE.GetLastError(self._idInst))))
if wType == XTYP_DISCONNECT:
print("Disconnect notification received from server")
return 0
示例9: WinMSGLoop
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def WinMSGLoop():
"""Run the main windows message loop."""
LPMSG = POINTER(MSG)
LRESULT = c_ulong
GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT))
TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,))
# restype = LRESULT
DispatchMessage = get_winfunc("user32", "DispatchMessageW", LRESULT, (LPMSG,))
msg = MSG()
lpmsg = byref(msg)
while GetMessage(lpmsg, HWND(), 0, 0) > 0:
TranslateMessage(lpmsg)
DispatchMessage(lpmsg)
示例10: notify_win
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def notify_win(title, text):
try:
from servo.win32_toast import WindowsToast
w = WindowsToast()
w.balloon_tip(title, text)
except:
from ctypes import Structure, windll, POINTER, sizeof
from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT
class FLASHWINDOW(Structure):
_fields_ = [("cbSize", UINT),
("hwnd", HANDLE),
("dwFlags", DWORD),
("uCount", UINT),
("dwTimeout", DWORD)]
FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
FLASHW_CAPTION = 0x01
FLASHW_TRAY = 0x02
FLASHW_TIMERNOFG = 0x0C
params = FLASHWINDOW(sizeof(FLASHWINDOW),
windll.kernel32.GetConsoleWindow(),
FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
FlashWindowEx(params)
示例11: WinMSGLoop
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import UINT [as 别名]
def WinMSGLoop():
"""Run the main windows message loop."""
from ctypes import POINTER, byref, c_ulong
from ctypes.wintypes import BOOL, HWND, MSG, UINT
LPMSG = POINTER(MSG)
LRESULT = c_ulong
GetMessage = get_winfunc(
"user32",
"GetMessageW",
BOOL,
(LPMSG, HWND, UINT, UINT)
)
TranslateMessage = get_winfunc(
"user32",
"TranslateMessage",
BOOL,
(LPMSG,)
)
# restype = LRESULT
DispatchMessage = get_winfunc(
"user32",
"DispatchMessageW",
LRESULT,
(LPMSG,)
)
msg = MSG()
lpmsg = byref(msg)
while GetMessage(lpmsg, HWND(), 0, 0) > 0:
TranslateMessage(lpmsg)
DispatchMessage(lpmsg)