Commit a7e823fd authored by Thomas Heller's avatar Thomas Heller

Add some windows datatypes that were missing from this file, and add

the aliases defined in windows header files for the structures.
parent 6d3d339d
###################################################################### ######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. # # This file should be kept compatible with Python 2.3, see PEP 291. #
###################################################################### ######################################################################
# XXX This module needs cleanup.
# The most useful windows datatypes
from ctypes import * from ctypes import *
DWORD = c_ulong
WORD = c_ushort
BYTE = c_byte BYTE = c_byte
WORD = c_ushort
DWORD = c_ulong
BOOLEAN = BYTE
BOOL = c_long
VARIANT_BOOL = c_short
ULONG = c_ulong ULONG = c_ulong
LONG = c_long LONG = c_long
# in the windows header files, these are structures.
LARGE_INTEGER = c_longlong LARGE_INTEGER = c_longlong
ULARGE_INTEGER = c_ulonglong ULARGE_INTEGER = c_ulonglong
LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p
LPCWSTR = LPWSTR = c_wchar_p
LPCSTR = LPSTR = c_char_p
WPARAM = c_uint
LPARAM = c_long
ATOM = WORD
LANGID = WORD
COLORREF = DWORD
LGRPID = DWORD
LCTYPE = DWORD
LCID = DWORD
################################################################
# HANDLE types
HANDLE = c_ulong # in the header files: void * HANDLE = c_ulong # in the header files: void *
HWND = HANDLE HACCEL = HANDLE
HBITMAP = HANDLE
HBRUSH = HANDLE
HCOLORSPACE = HANDLE
HDC = HANDLE HDC = HANDLE
HMODULE = HANDLE HDESK = HANDLE
HDWP = HANDLE
HENHMETAFILE = HANDLE
HFONT = HANDLE
HGDIOBJ = HANDLE
HGLOBAL = HANDLE
HHOOK = HANDLE
HICON = HANDLE
HINSTANCE = HANDLE HINSTANCE = HANDLE
HRGN = HANDLE
HTASK = HANDLE
HKEY = HANDLE HKEY = HANDLE
HPEN = HANDLE HKL = HANDLE
HGDIOBJ = HANDLE HLOCAL = HANDLE
HMENU = HANDLE HMENU = HANDLE
HMETAFILE = HANDLE
HMODULE = HANDLE
HMONITOR = HANDLE
HPALETTE = HANDLE
HPEN = HANDLE
HRGN = HANDLE
HRSRC = HANDLE
HSTR = HANDLE
HTASK = HANDLE
HWINSTA = HANDLE
HWND = HANDLE
SC_HANDLE = HANDLE
SERVICE_STATUS_HANDLE = HANDLE
LCID = DWORD ################################################################
# Some important structure definitions
WPARAM = c_uint
LPARAM = c_long
BOOL = c_long
VARIANT_BOOL = c_short
LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p
LPCWSTR = LPWSTR = c_wchar_p
LPCSTR = LPSTR = c_char_p
class RECT(Structure): class RECT(Structure):
_fields_ = [("left", c_long), _fields_ = [("left", c_long),
("top", c_long), ("top", c_long),
("right", c_long), ("right", c_long),
("bottom", c_long)] ("bottom", c_long)]
RECTL = RECT tagRECT = _RECTL = RECTL = RECT
class _SMALL_RECT(Structure):
_fields_ = [('Left', c_short),
('Top', c_short),
('Right', c_short),
('Bottom', c_short)]
SMALL_RECT = _SMALL_RECT
class _COORD(Structure):
_fields_ = [('X', c_short),
('Y', c_short)]
class POINT(Structure): class POINT(Structure):
_fields_ = [("x", c_long), _fields_ = [("x", c_long),
("y", c_long)] ("y", c_long)]
POINTL = POINT tagPOINT = _POINTL = POINTL = POINT
class SIZE(Structure): class SIZE(Structure):
_fields_ = [("cx", c_long), _fields_ = [("cx", c_long),
("cy", c_long)] ("cy", c_long)]
SIZEL = SIZE tagSIZE = SIZEL = SIZE
def RGB(red, green, blue): def RGB(red, green, blue):
return red + (green << 8) + (blue << 16) return red + (green << 8) + (blue << 16)
...@@ -65,6 +109,7 @@ def RGB(red, green, blue): ...@@ -65,6 +109,7 @@ def RGB(red, green, blue):
class FILETIME(Structure): class FILETIME(Structure):
_fields_ = [("dwLowDateTime", DWORD), _fields_ = [("dwLowDateTime", DWORD),
("dwHighDateTime", DWORD)] ("dwHighDateTime", DWORD)]
_FILETIME = FILETIME
class MSG(Structure): class MSG(Structure):
_fields_ = [("hWnd", HWND), _fields_ = [("hWnd", HWND),
...@@ -73,6 +118,7 @@ class MSG(Structure): ...@@ -73,6 +118,7 @@ class MSG(Structure):
("lParam", LPARAM), ("lParam", LPARAM),
("time", DWORD), ("time", DWORD),
("pt", POINT)] ("pt", POINT)]
tagMSG = MSG
MAX_PATH = 260 MAX_PATH = 260
class WIN32_FIND_DATAA(Structure): class WIN32_FIND_DATAA(Structure):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment