mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
add jaraco to test sym links on Windows. Fixes #894
This commit is contained in:
parent
fd5ee775e0
commit
52cc753881
50 changed files with 3862 additions and 7 deletions
50
libs/jaraco/windows/api/message.py
Normal file
50
libs/jaraco/windows/api/message.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
jaraco.windows.message
|
||||
|
||||
Windows Messaging support
|
||||
"""
|
||||
|
||||
import ctypes
|
||||
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, DWORD, LPVOID
|
||||
|
||||
import six
|
||||
|
||||
LRESULT = LPARAM
|
||||
|
||||
class LPARAM_wstr(LPARAM):
|
||||
"""
|
||||
A special instance of LPARAM that can be constructed from a string
|
||||
instance (for functions such as SendMessage, whose LPARAM may point to
|
||||
a unicode string).
|
||||
"""
|
||||
@classmethod
|
||||
def from_param(cls, param):
|
||||
if isinstance(param, six.string_types):
|
||||
return LPVOID.from_param(six.text_type(param))
|
||||
return LPARAM.from_param(param)
|
||||
|
||||
SendMessage = ctypes.windll.user32.SendMessageW
|
||||
SendMessage.argtypes = (HWND, UINT, WPARAM, LPARAM_wstr)
|
||||
SendMessage.restype = LRESULT
|
||||
|
||||
HWND_BROADCAST=0xFFFF
|
||||
WM_SETTINGCHANGE=0x1A
|
||||
|
||||
# constants from http://msdn.microsoft.com/en-us/library/ms644952%28v=vs.85%29.aspx
|
||||
SMTO_ABORTIFHUNG = 0x02
|
||||
SMTO_BLOCK = 0x01
|
||||
SMTO_NORMAL = 0x00
|
||||
SMTO_NOTIMEOUTIFNOTHUNG = 0x08
|
||||
SMTO_ERRORONEXIT = 0x20
|
||||
|
||||
SendMessageTimeout = ctypes.windll.user32.SendMessageTimeoutW
|
||||
SendMessageTimeout.argtypes = SendMessage.argtypes + (
|
||||
UINT, UINT, ctypes.POINTER(DWORD)
|
||||
)
|
||||
SendMessageTimeout.restype = LRESULT
|
||||
|
||||
def unicode_as_lparam(source):
|
||||
pointer = ctypes.cast(ctypes.c_wchar_p(source), ctypes.c_void_p)
|
||||
return LPARAM(pointer.value)
|
Loading…
Add table
Add a link
Reference in a new issue