1 #Copyright (c) 2008 Vincent Povirk
3 #Permission is hereby granted, free of charge, to any person
4 #obtaining a copy of this software and associated documentation
5 #files (the "Software"), to deal in the Software without
6 #restriction, including without limitation the rights to use,
7 #copy, modify, merge, publish, distribute, sublicense, and/or sell
8 #copies of the Software, and to permit persons to whom the
9 #Software is furnished to do so, subject to the following
12 #The above copyright notice and this permission notice shall be
13 #included in all copies or substantial portions of the Software.
15 #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 #OTHER DEALINGS IN THE SOFTWARE.
25 # see http://msdn.microsoft.com/en-us/library/ms646968(VS.85).aspx
27 from ctypes
import windll
, byref
28 from windef
import HWND
, HBITMAP
, INT
, LPPOINT
, POINT
, UINT
29 from winliteutils
import NONZERO
30 _user32
= windll
.user32
32 _user32
.CreateCaret
.argtypes
= [HWND
, HBITMAP
, INT
, INT
]
33 _user32
.CreateCaret
.restype
= NONZERO
34 CreateCaret
= _user32
.CreateCaret
36 _user32
.DestroyCaret
.argtypes
= []
37 _user32
.DestroyCaret
.restype
= NONZERO
38 DestroyCaret
= _user32
.DestroyCaret
40 _user32
.GetCaretBlinkTime
.argtypes
= []
41 _user32
.GetCaretBlinkTime
.restype
= NONZERO
42 GetCaretBlinkTime
= _user32
.GetCaretBlinkTime
44 _user32
.GetCaretPos
.argtypes
= [LPPOINT
]
45 _user32
.GetCaretPos
.restype
= NONZERO
48 _user32
.GetCaretPos(byref(result
))
51 _user32
.HideCaret
.argtypes
= [HWND
]
52 _user32
.HideCaret
.restype
= NONZERO
53 HideCaret
= _user32
.HideCaret
55 _user32
.SetCaretBlinkTime
.argtypes
= [UINT
]
56 _user32
.SetCaretBlinkTime
.restype
= NONZERO
57 SetCaretBlinkTime
= _user32
.SetCaretBlinkTime
59 _user32
.SetCaretPos
.argtypes
= [INT
, INT
]
60 _user32
.SetCaretPos
.restype
= NONZERO
61 SetCaretPos
= _user32
.SetCaretPos
63 _user32
.ShowCaret
.argtypes
= [HWND
]
64 _user32
.ShowCaret
.restype
= NONZERO
65 ShowCaret
= _user32
.ShowCaret