Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30824/src
Modified Files:
PyDEVMODE.cpp PyTime.cpp win32dynamicdialog.cpp win32event.i
win32gui.i win32process.i
Log Message:
[ 1377153 ] Improved Windows CE support, from Luke Dunstan
Index: win32process.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** win32process.i 2 May 2005 02:57:25 -0000 1.16
--- win32process.i 10 Jan 2006 03:43:21 -0000 1.17
***************
*** 24,27 ****
--- 24,28 ----
static BOOL (WINAPI *fpEnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD) = NULL;
static DWORD (WINAPI *fpGetModuleFileNameEx)(HANDLE, HMODULE, WCHAR *, DWORD) = NULL;
+ #ifndef MS_WINCE
static BOOL (WINAPI *fpGetProcessMemoryInfo)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD) = NULL;
static BOOL (WINAPI *fpGetProcessTimes)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME) = NULL;
***************
*** 32,35 ****
--- 33,37 ----
static BOOL (WINAPI *fpGetProcessShutdownParameters)(LPDWORD, LPDWORD) = NULL;
static BOOL (WINAPI *fpSetProcessShutdownParameters)(DWORD, DWORD) = NULL;
+ #endif
// Support for a STARTUPINFO object.
***************
*** 1025,1028 ****
--- 1027,1031 ----
%}
+ #ifndef MS_WINCE
// @pyswig <o dict>|GetProcessMemoryInfo|Returns process memory statistics as a dict representing a PROCESS_MEMORY_COUNTERS struct
%native(GetProcessMemoryInfo) PyGetProcessMemoryInfo;
***************
*** 1224,1228 ****
}
%}
!
%init %{
--- 1227,1231 ----
}
%}
! #endif // MS_WINCE
%init %{
***************
*** 1233,1250 ****
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! fp=GetProcAddress(hmodule, "EnumProcesses");
if (fp!=NULL)
fpEnumProcesses=(BOOL (WINAPI *)(DWORD *, DWORD, DWORD *))(fp);
! fp=GetProcAddress(hmodule, "EnumProcessModules");
if (fp!=NULL)
fpEnumProcessModules=(BOOL (WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD))(fp);
! fp=GetProcAddress(hmodule, "GetModuleFileNameExW");
if (fp!=NULL)
fpGetModuleFileNameEx=(DWORD (WINAPI *)(HANDLE, HMODULE, WCHAR *, DWORD))(fp);
! fp=GetProcAddress(hmodule,"GetProcessMemoryInfo");
if (fp!=NULL)
fpGetProcessMemoryInfo=(BOOL (WINAPI *)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD))(fp);
}
hmodule=GetModuleHandle(_T("Kernel32.dll"));
if (hmodule==NULL)
--- 1236,1256 ----
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! fp=GetProcAddress(hmodule, _T("EnumProcesses"));
if (fp!=NULL)
fpEnumProcesses=(BOOL (WINAPI *)(DWORD *, DWORD, DWORD *))(fp);
! fp=GetProcAddress(hmodule, _T("EnumProcessModules"));
if (fp!=NULL)
fpEnumProcessModules=(BOOL (WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD))(fp);
! fp=GetProcAddress(hmodule, _T("GetModuleFileNameExW"));
if (fp!=NULL)
fpGetModuleFileNameEx=(DWORD (WINAPI *)(HANDLE, HMODULE, WCHAR *, DWORD))(fp);
! #ifndef MS_WINCE
! fp=GetProcAddress(hmodule,_T("GetProcessMemoryInfo"));
if (fp!=NULL)
fpGetProcessMemoryInfo=(BOOL (WINAPI *)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD))(fp);
+ #endif
}
+ #ifndef MS_WINCE
hmodule=GetModuleHandle(_T("Kernel32.dll"));
if (hmodule==NULL)
***************
*** 1279,1282 ****
--- 1285,1289 ----
fpGetProcessWindowStation=(HWINSTA (WINAPI *)(void))(fp);
}
+ #endif // MS_WINCE
%}
Index: win32dynamicdialog.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32dynamicdialog.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** win32dynamicdialog.cpp 19 Nov 2002 10:55:54 -0000 1.2
--- win32dynamicdialog.cpp 10 Jan 2006 03:43:21 -0000 1.3
***************
*** 46,50 ****
--- 46,52 ----
#define BASED_CODE
+ #ifndef ASSERT
#define ASSERT(a)
+ #endif
#define RETURN_TYPE_ERR(err) do {PyErr_SetString(PyExc_TypeError,err);return NULL;} while (0)
Index: PyTime.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyTime.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** PyTime.cpp 6 Mar 2005 23:27:01 -0000 1.14
--- PyTime.cpp 10 Jan 2006 03:43:21 -0000 1.15
***************
*** 15,23 ****
#include <oleauto.h> // Time conversion functions on CE.
// The Python helpers.
! DL_IMPORT(BOOL) PyCE_UnixTimeToFileTime(time_t t, LPFILETIME pft);
! DL_IMPORT(BOOL) PyCE_UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
! DL_IMPORT(BOOL) PyCE_FileTimeToUnixTime(FILETIME *pft, time_t *pt);
! DL_IMPORT(BOOL) PyCE_SystemTimeToUnixTime(SYSTEMTIME *pst, time_t *pt);
! DL_IMPORT(void) PyCE_TimeStructToSystemTime(struct tm *ptm, SYSTEMTIME *pst);
#endif
--- 15,23 ----
#include <oleauto.h> // Time conversion functions on CE.
// The Python helpers.
! BOOL PyCE_UnixTimeToFileTime(time_t t, LPFILETIME pft);
! BOOL PyCE_UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
! BOOL PyCE_FileTimeToUnixTime(FILETIME *pft, time_t *pt);
! BOOL PyCE_SystemTimeToUnixTime(SYSTEMTIME *pst, time_t *pt);
! void PyCE_TimeStructToSystemTime(struct tm *ptm, SYSTEMTIME *pst);
#endif
***************
*** 702,708 ****
// We dont have a decent time implementation, but
// we need _some_ implementation of these functions!
! extern "C" {
! DL_IMPORT(double) PyCE_SystemTimeToCTime(SYSTEMTIME* pstTime);
! DL_IMPORT(BOOL) PyCE_UnixTimeToFileTime(time_t t, LPFILETIME pft);
}
--- 702,746 ----
// We dont have a decent time implementation, but
// we need _some_ implementation of these functions!
!
! double PyCE_SystemTimeToCTime(SYSTEMTIME* pstTime)
! {
! SYSTEMTIME stBase;
! FILETIME ftTime;
! FILETIME ftBase;
! __int64 iTime;
! __int64 iBase;
!
! SystemTimeToFileTime(pstTime, &ftTime);
!
! stBase.wYear = 1970;
! stBase.wMonth = 1;
! stBase.wDayOfWeek = 1;
! stBase.wDay = 1;
! stBase.wHour = 0;
! stBase.wMinute = 0;
! stBase.wSecond = 0;
! stBase.wMilliseconds = 0;
! SystemTimeToFileTime(&stBase, &ftBase);
!
! iTime=ftTime.dwHighDateTime;
! iTime=iTime << 32;
! iTime |= ftTime.dwLowDateTime;
!
! iBase=ftBase.dwHighDateTime;
! iBase=iBase << 32;
! iBase |= ftBase.dwLowDateTime;
!
! return (double)((iTime - iBase) / 10000000L);
! }
!
! BOOL PyCE_UnixTimeToFileTime(time_t t, LPFILETIME pft)
! {
! // Note that LONGLONG is a 64-bit value
! LONGLONG ll;
! ll = ((__int64)t * 10000000) + 116444736000000000;
! // ll = Int32x32To64(t, 10000000) + 116444736000000000;
! pft->dwLowDateTime = (DWORD)ll;
! pft->dwHighDateTime = (DWORD)(ll >> 32);
! return TRUE;
}
Index: win32event.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32event.i,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** win32event.i 30 Jan 2005 13:40:41 -0000 1.7
--- win32event.i 10 Jan 2006 03:43:21 -0000 1.8
***************
*** 101,106 ****
--- 101,108 ----
#define SYNCHRONIZE SYNCHRONIZE // Windows NT only: Enables use of the event handle in any of the wait functions to wait for the events state to be signaled.
+ #ifndef MS_WINCE
// @pyswig |CancelWaitableTimer|Cancels a waiting timer.
BOOLAPI CancelWaitableTimer(PyHANDLE handle);
+ #endif
#end
***************
*** 132,136 ****
TCHAR * INPUT_NULLOK // @pyparm <o PyIUnicode>|semaphoreName||semaphore-object name, or None
);
- #endif // MS_WINCE
PyHANDLE CreateWaitableTimer(
--- 134,137 ----
***************
*** 139,142 ****
--- 140,144 ----
TCHAR * INPUT_NULLOK // pointer to timer object name
);
+ #endif // MS_WINCE
// GetOverlappedResult
***************
*** 284,289 ****
);
- #endif /* MS_WINCE */
-
//@pyswig handle|OpenWaitableTimer|Opens an existing named waitable timer object
PyHANDLE OpenWaitableTimer(
--- 286,289 ----
***************
*** 293,296 ****
--- 293,298 ----
);
+ #endif /* MS_WINCE */
+
// @pyswig |PulseEvent|Provides a single operation that sets (to signaled) the state of the specified event object and then resets it (to nonsignaled) after releasing the appropriate number of waiting threads.
BOOLAPI PulseEvent(
***************
*** 323,326 ****
--- 325,329 ----
);
+ #ifndef MS_WINCE
// @pyswig |SetWaitableTimer|Sets a waitable timer.
BOOLAPI_NL SetWaitableTimer(
***************
*** 338,341 ****
--- 341,345 ----
BOOL bAlertable // alertable flag
);
+ #endif
%{
Index: PyDEVMODE.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyDEVMODE.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyDEVMODE.cpp 29 Jul 2005 01:33:08 -0000 1.3
--- PyDEVMODE.cpp 10 Jan 2006 03:43:21 -0000 1.4
***************
*** 5,8 ****
--- 5,12 ----
#include "PyWinObjects.h"
+ #ifdef MS_WINCE
+ #define DM_SPECVERSION 0
+ #endif
+
// @object PyDEVMODE|Python object wrapping a DEVMODE structure
struct PyMethodDef PyDEVMODE::methods[] = {
***************
*** 25,30 ****
--- 29,36 ----
{"PaperLength", T_SHORT, OFF(devmode.dmPaperLength), 0, "Specified in 1/10 millimeters"},
{"PaperWidth", T_SHORT, OFF(devmode.dmPaperWidth), 0, "Specified in 1/10 millimeters"},
+ #ifndef MS_WINCE
{"Position_x", T_LONG, OFF(devmode.dmPosition.x), 0, "Position of display relative to desktop"},
{"Position_y", T_LONG, OFF(devmode.dmPosition.y), 0, "Position of display relative to desktop"},
+ #endif
// {"DisplayOrientation",T_ULONG,OFF(devmode.dmDisplayOrientation), 0, "Display rotation: DMDO_DEFAULT,DMDO_90, DMDO_180, DMDO_270"},
// {"DisplayFixedOutput",T_ULONG,OFF(devmode.dmDisplayFixedOutput), 0, "DMDFO_DEFAULT, DMDFO_CENTER, DMDFO_STRETCH"},
***************
*** 45,48 ****
--- 51,57 ----
{"DisplayFlags", T_ULONG, OFF(devmode.dmDisplayFlags), 0, "Combination of DM_GRAYSCALE and DM_INTERLACED"},
{"DisplayFrequency",T_ULONG, OFF(devmode.dmDisplayFrequency), 0, "Refresh rate"},
+ #ifdef MS_WINCE
+ {"DisplayOrientation",T_ULONG,OFF(devmode.dmDisplayOrientation), 0, "Display rotation: DMDO_DEFAULT,DMDO_90, DMDO_180, DMDO_270"},
+ #else
{"ICMMethod", T_ULONG, OFF(devmode.dmICMMethod), 0, ""},
{"ICMIntent", T_ULONG, OFF(devmode.dmICMIntent), 0, ""},
***************
*** 56,60 ****
{"PanningWidth", T_ULONG, OFF(devmode.dmPanningWidth), 0, ""},
{"PanningHeight", T_ULONG, OFF(devmode.dmPanningHeight), 0, ""},
! #endif
{NULL}
};
--- 65,71 ----
{"PanningWidth", T_ULONG, OFF(devmode.dmPanningWidth), 0, ""},
{"PanningHeight", T_ULONG, OFF(devmode.dmPanningHeight), 0, ""},
! {"DriverData", T_OBJECT, OFF(obdummy), 0, "Driver data appended to end of structure"},
! #endif // WINVER >= 0x0500
! #endif // !MS_WINCE
{NULL}
};
Index: win32gui.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -d -r1.73 -r1.74
*** win32gui.i 10 Jan 2006 00:22:15 -0000 1.73
--- win32gui.i 10 Jan 2006 03:43:21 -0000 1.74
***************
*** 34,37 ****
--- 34,38 ----
#ifdef MS_WINCE
#include "winbase.h"
+ #define IS_INTRESOURCE(res) (((DWORD)(res) & 0xffff0000) == 0)
#endif
***************
*** 123,130 ****
%{
! extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if ( dwReason == DLL_PROCESS_ATTACH )
! g_dllhandle = hInstance;
return TRUE;
}
--- 124,140 ----
%{
! #ifdef MS_WINCE
! typedef HANDLE HINST_ARG;
! // WinCE gives a compile error this with dllexport
! #define DECLSPEC_DLLMAIN
! #else
! typedef HINSTANCE HINST_ARG;
! #define DECLSPEC_DLLMAIN __declspec(dllexport)
! #endif
!
! extern "C" DECLSPEC_DLLMAIN BOOL WINAPI DllMain(HINST_ARG hInstance, DWORD dwReason, LPVOID lpReserved)
{
if ( dwReason == DLL_PROCESS_ATTACH )
! g_dllhandle = (HINSTANCE)hInstance;
return TRUE;
}
***************
*** 169,172 ****
--- 179,185 ----
typedef long HBRUSH
+ %apply HPEN {long};
+ typedef long HPEN
+
%apply HRGN {long};
typedef long HRGN
***************
*** 1435,1438 ****
--- 1448,1452 ----
}
+ #ifndef MS_WINCE
// @pyswig int|FlashWindow|The FlashWindow function flashes the specified window one time. It does not change the active state of the window.
// @pyparm int|hwnd||
***************
*** 1455,1459 ****
return NULL;
// not on NT
! HMODULE hmod = GetModuleHandle("user32");
BOOL (WINAPI *pfnFW)(PFLASHWINFO) = NULL;
if (hmod)
--- 1469,1473 ----
return NULL;
// not on NT
! HMODULE hmod = GetModuleHandle(_T("user32"));
BOOL (WINAPI *pfnFW)(PFLASHWINFO) = NULL;
if (hmod)
***************
*** 1471,1474 ****
--- 1485,1489 ----
%}
%native(FlashWindowEx) PyFlashWindowEx;
+ #endif // MS_WINCE
// To avoid LoadLibrary etc (ie, keep my life simple) for functions
***************
*** 1710,1715 ****
--- 1725,1732 ----
BOOLAPI PostThreadMessage(DWORD dwThreadId, UINT msg, WPARAM wParam, LPARAM lParam);
+ #ifndef MS_WINCE
// @pyswig int|ReplyMessage|Used to reply to a message sent through the SendMessage function without returning control to the function that called SendMessage.
BOOLAPI ReplyMessage(int lResult); // @pyparm int|result||Specifies the result of the message processing. The possible values are based on the message sent.
+ #endif /* not MS_WINCE */
// @pyswig int|RegisterWindowMessage|Defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages.
***************
*** 1771,1774 ****
--- 1788,1792 ----
}
+ #ifndef MS_WINCE
// @pyswig |EnumThreadWindows|Enumerates all top-level windows associated with a thread on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumThreadWindows continues until the last top-level window associated with the thread is enumerated or the callback function returns FALSE
static PyObject *PyEnumThreadWindows(PyObject *self, PyObject *args)
***************
*** 1825,1832 ****
--- 1843,1853 ----
}
+ #endif /* not MS_WINCE */
%}
%native (EnumWindows) PyEnumWindows;
+ #ifndef MS_WINCE
%native (EnumThreadWindows) PyEnumThreadWindows;
%native (EnumChildWindows) PyEnumChildWindows;
+ #endif /* not MS_WINCE */
***************
*** 2009,2012 ****
--- 2030,2035 ----
%native (GetWindowText) PyGetWindowText;
+ int GetWindowTextLength(HWND hwnd);
+
// @pyswig |InitCommonControls|Initializes the common controls.
void InitCommonControls();
***************
*** 2045,2048 ****
--- 2068,2072 ----
HCURSOR GetCursor();
+ #ifndef MS_WINCE
%{
// @pyswig flags, hcursor, (x,y)|GetCursorInfo|Retrieves information about the global cursor.
***************
*** 2059,2062 ****
--- 2083,2087 ----
%}
%native(GetCursorInfo) PyGetCursorInfo;
+ #endif
// @pyswig HACCEL|CreateAcceleratorTable|Creates an accelerator table
***************
*** 2127,2133 ****
--- 2152,2160 ----
HICON LoadIcon(HINSTANCE hInst, RESOURCE_ID name);
+ #ifndef MS_WINCE
// @pyswig HICON|CopyIcon|Copies an icon
// @pyparm int|hicon||Existing icon
HICON CopyIcon(HICON hicon);
+ #endif
// @pyswig |DrawIcon|Draws an icon or cursor into the specified device context.
***************
*** 2181,2186 ****
%native (CreateIconFromResource) PyCreateIconFromResource;
- HICON CreateIconIndirect();
-
// @pyswig HANDLE|LoadImage|Loads a bitmap, cursor or icon
HANDLE LoadImage(HINSTANCE hInst, // @pyparm int|hinst||Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero.
--- 2208,2211 ----
***************
*** 2196,2199 ****
--- 2221,2225 ----
#define LR_DEFAULTCOLOR LR_DEFAULTCOLOR
+ #ifndef MS_WINCE
#define LR_CREATEDIBSECTION LR_CREATEDIBSECTION
#define LR_DEFAULTSIZE LR_DEFAULTSIZE
***************
*** 2204,2207 ****
--- 2230,2234 ----
#define LR_SHARED LR_SHARED
#define LR_VGACOLOR LR_VGACOLOR
+ #endif /* not MS_WINCE */
// @pyswig |DeleteObject|Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.
***************
*** 2240,2243 ****
--- 2267,2271 ----
);
+ #ifndef MS_WINCE
// @pyswig int|SetStretchBltMode|
// @rdesc If the function succeeds, the return value is the previous stretching mode.
***************
*** 2246,2249 ****
--- 2274,2278 ----
// @pyparm int|dc||
// @pyparm int|mode||
+ #endif /* not MS_WINCE */
%ifdef WINXPGUI
***************
*** 2280,2283 ****
--- 2309,2313 ----
#define ILC_COLOR ILC_COLOR
+ #ifndef MS_WINCE
#define ILC_COLOR4 ILC_COLOR4
#define ILC_COLOR8 ILC_COLOR8
***************
*** 2285,2288 ****
--- 2315,2319 ----
#define ILC_COLOR24 ILC_COLOR24
#define ILC_COLOR32 ILC_COLOR32
+ #endif /* not MS_WINCE */
#define ILC_COLORDDB ILC_COLORDDB
#define ILC_MASK ILC_MASK
***************
*** 2383,2386 ****
--- 2414,2418 ----
TCHAR *INPUT_NULLOK); // @pyparm string|WindowName||
+ #ifndef MS_WINCE
// @pyswig int|FindWindowEx|Retrieves a handle to the top-level window whose class name and window name match the specified strings.
HWND FindWindowEx(
***************
*** 2403,2412 ****
BOOL DragDetect(HWND hWnd, POINT INPUT);
- // @pyswig int|GetDoubleClickTime|
- UINT GetDoubleClickTime();
-
// @pyswig |SetDoubleClickTime|
// @pyparm int|newVal||
BOOLAPI SetDoubleClickTime(UINT val);
// @pyswig |HideCaret|
--- 2435,2445 ----
BOOL DragDetect(HWND hWnd, POINT INPUT);
// @pyswig |SetDoubleClickTime|
// @pyparm int|newVal||
BOOLAPI SetDoubleClickTime(UINT val);
+ #endif /* not MS_WINCE */
+
+ // @pyswig int|GetDoubleClickTime|
+ UINT GetDoubleClickTime();
// @pyswig |HideCaret|
***************
*** 2508,2515 ****
);
-
- #ifndef MS_WINCE
HINSTANCE GetModuleHandle(TCHAR *INPUT_NULLOK);
- #endif
// @pyswig (left, top, right, bottom)|GetWindowRect|
--- 2541,2545 ----
***************
*** 2524,2529 ****
--- 2554,2561 ----
void PostQuitMessage(int rc);
+ #ifndef MS_WINCE
// @pyswig |WaitMessage|Waits for a message
BOOLAPI WaitMessage();
+ #endif /* MS_WINCE */
// @pyswig int|SetWindowPos|
***************
*** 2721,2724 ****
--- 2753,2774 ----
// Should go in win32sh?
%{
+ #ifdef MS_WINCE
+ BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid)
+ {
+ PyObject *obTip=NULL;
+ memset(pnid, 0, sizeof(*pnid));
+ pnid->cbSize = sizeof(*pnid);
+ if (!PyArg_ParseTuple(ob, "l|iiilO:NOTIFYICONDATA tuple", &pnid->hWnd, &pnid->uID, &pnid->uFlags, &pnid->uCallbackMessage, &pnid->hIcon, &obTip))
+ return FALSE;
+ if (obTip) {
+ TCHAR *szTip;
+ if (!PyWinObject_AsTCHAR(obTip, &szTip))
+ return NULL;
+ _tcsncpy(pnid->szTip, szTip, sizeof(pnid->szTip)/sizeof(TCHAR));
+ PyWinObject_FreeTCHAR(szTip);
+ }
+ return TRUE;
+ }
+ #else // MS_WINCE
BOOL PyObject_AsNOTIFYICONDATA(PyObject *ob, NOTIFYICONDATA *pnid)
{
***************
*** 2755,2762 ****
--- 2805,2815 ----
return TRUE;
}
+ #endif // MS_WINCE
%}
#define NIF_ICON NIF_ICON
#define NIF_MESSAGE NIF_MESSAGE
#define NIF_TIP NIF_TIP
+
+ #ifndef MS_WINCE
#define NIF_INFO NIF_INFO
#define NIIF_WARNING NIIF_WARNING
***************
*** 2764,2767 ****
--- 2817,2821 ----
#define NIIF_NONE NIIF_NONE
#define NIIF_INFO NIIF_INFO
+ #endif
#define NIM_ADD NIM_ADD // Adds an icon to the status area.
***************
*** 2851,2856 ****
#ifdef MS_WINCE
%{
! // Where oh where has this function gone, oh where oh where can it be?
! //#include "dbgapi.h"
static PyObject *PyNKDbgPrintfW(PyObject *self, PyObject *args)
{
--- 2905,2909 ----
#ifdef MS_WINCE
%{
! #include "dbgapi.h"
static PyObject *PyNKDbgPrintfW(PyObject *self, PyObject *args)
{
***************
*** 2861,2865 ****
if (!PyWinObject_AsTCHAR(obtext, &text))
return NULL;
! // NKDbgPrintfW(_T("%s"), text);
PyWinObject_FreeTCHAR(text);
Py_INCREF(Py_None);
--- 2914,2918 ----
if (!PyWinObject_AsTCHAR(obtext, &text))
return NULL;
! NKDbgPrintfW(_T("%s"), text);
PyWinObject_FreeTCHAR(text);
Py_INCREF(Py_None);
***************
*** 2936,2941 ****
--- 2989,2996 ----
#define TPM_NONOTIFY TPM_NONOTIFY
#define TPM_RETURNCMD TPM_RETURNCMD
+ #ifndef MS_WINCE
#define TPM_LEFTBUTTON TPM_LEFTBUTTON
#define TPM_RIGHTBUTTON TPM_RIGHTBUTTON
+ #endif /* not MS_WINCE */
%{
***************
*** 2964,2967 ****
--- 3019,3023 ----
}
+ #ifndef MS_WINCE
// @pyswig int|ExtractIcon|
// @pyparm int|hinstance||
***************
*** 2971,2974 ****
--- 3027,3031 ----
// @rdesc The result is a HICON.
HICON ExtractIcon(HINSTANCE hinst, TCHAR *modName, UINT index);
+ #endif /* not MS_WINCE */
// @pyswig int|ExtractIconEx|
***************
*** 2983,2996 ****
{
int i;
! char *fname;
int index, nicons=1, nicons_got;
! if (!PyArg_ParseTuple(args, "si|i", &fname, &index, &nicons))
return NULL;
if (index==-1) {
! nicons = ExtractIconEx(fname, index, NULL, NULL, 0);
return PyInt_FromLong(nicons);
}
! if (nicons<=0)
return PyErr_Format(PyExc_ValueError, "Must supply a valid number of icons to fetch.");
HICON *rgLarge = NULL;
HICON *rgSmall = NULL;
--- 3040,3061 ----
{
int i;
! PyObject *obFname;
! TCHAR *fname;
int index, nicons=1, nicons_got;
! if (!PyArg_ParseTuple(args, "Oi|i", &obFname, &index, &nicons))
! return NULL;
! if (!PyWinObject_AsTCHAR(obFname, &fname, TRUE))
return NULL;
+ #ifndef MS_WINCE // CE doesn't have this special "-1" handling.
if (index==-1) {
! nicons = (int)ExtractIconEx(fname, index, NULL, NULL, 0);
! PyWinObject_FreeTCHAR(fname);
return PyInt_FromLong(nicons);
}
! #endif // MS_WINCE
! if (nicons<=0) {
! PyWinObject_FreeTCHAR(fname);
return PyErr_Format(PyExc_ValueError, "Must supply a valid number of icons to fetch.");
+ }
HICON *rgLarge = NULL;
HICON *rgSmall = NULL;
***************
*** 3008,3016 ****
goto done;
}
! nicons_got = ExtractIconEx(fname, index, rgLarge, rgSmall, nicons);
if (nicons_got==-1) {
PyWin_SetAPIError("ExtractIconEx");
goto done;
}
// Asking for 1 always says it got 2!?
nicons = min(nicons, nicons_got);
--- 3073,3085 ----
goto done;
}
! nicons_got = (int)ExtractIconEx(fname, index, rgLarge, rgSmall, nicons);
if (nicons_got==-1) {
PyWin_SetAPIError("ExtractIconEx");
goto done;
}
+ #ifdef MS_WINCE
+ /* On WinCE >= 2.1 the API actually returns a HICON */
+ nicons_got = 1;
+ #endif
// Asking for 1 always says it got 2!?
nicons = min(nicons, nicons_got);
***************
*** 3025,3028 ****
--- 3094,3098 ----
ret = Py_BuildValue("OO", objects_large, objects_small);
done:
+ PyWinObject_FreeTCHAR(fname);
Py_XDECREF(objects_large);
Py_XDECREF(objects_small);
***************
*** 3038,3041 ****
--- 3108,3112 ----
BOOLAPI DestroyIcon( HICON hicon);
+ #ifndef MS_WINCE
// @pyswig tuple|GetIconInfo|
// @pyparm int|hicon||The icon to query
***************
*** 3043,3046 ****
--- 3114,3118 ----
// The hbmMask and hbmColor items are bitmaps created for the caller, so must be freed.
BOOLAPI GetIconInfo( HICON hicon, ICONINFO *OUTPUT);
+ #endif /* not MS_WINCE */
// @pyswig |ScreenToClient|Convert screen coordinates to client coords
***************
*** 3133,3136 ****
--- 3205,3209 ----
#endif
+ #ifndef MS_WINCE
// @pyswig int|GetMenuItemCount|
int GetMenuItemCount(HMENU hMenu);
***************
*** 3147,3150 ****
--- 3220,3224 ----
// @pyswig |GetMenuDefaultItem|
int GetMenuDefaultItem(HMENU hMenu, UINT fByPos, UINT flags);
+ #endif /* not MS_WINCE */
// @pyswig |AppendMenu|
***************
*** 3155,3163 ****
// @pyswig |EnableMenuItem|
! BOOLAPI EnableMenuItem(HMENU hMenu, UINT uIDEnableItem, UINT uEnable);
// @pyswig int|CheckMenuItem|
int CheckMenuItem(HMENU hMenu, UINT uIDCheckItem, UINT uCheck);
// @pyswig |ModifyMenu|Changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item.
BOOLAPI ModifyMenu(
--- 3229,3241 ----
// @pyswig |EnableMenuItem|
! BOOL EnableMenuItem(HMENU hMenu, UINT uIDEnableItem, UINT uEnable);
// @pyswig int|CheckMenuItem|
int CheckMenuItem(HMENU hMenu, UINT uIDCheckItem, UINT uCheck);
+ // @pyswig HMENU|GetSubMenu|
+ HMENU GetSubMenu(HMENU hMenu, int nPos);
+
+ #ifndef MS_WINCE
// @pyswig |ModifyMenu|Changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item.
BOOLAPI ModifyMenu(
***************
*** 3166,3170 ****
UINT uFlags, // @pyparm int|uFlags||options
UINT uIDNewItem, // @pyparm int|uIDNewItem||identifier, menu, or submenu
! LPCTSTR lpNewItem // @pyparm string|newItem||menu item content
);
--- 3244,3248 ----
UINT uFlags, // @pyparm int|uFlags||options
UINT uIDNewItem, // @pyparm int|uIDNewItem||identifier, menu, or submenu
! TCHAR *INPUT // @pyparm string|newItem||menu item content
);
***************
*** 3183,3186 ****
--- 3261,3265 ----
HBITMAP hBitmapChecked // @pyparm int|hBitmapChecked||handle to checked bitmap
);
+ #endif /* not MS_WINCE */
// @pyswig |CheckMenuRadioItem|Checks a specified menu item and makes it a
***************
*** 3220,3224 ****
int DrawText(
HDC hDC, // @pyparm int/<o PyHANDLE>|hDC||The device context on which to draw
! LPCTSTR lpString, // @pyparm str|String||The text to be drawn
int nCount, // @pyparm int|nCount||The number of characters, use -1 for simple null-terminated string
RECT *BOTH, // @pyparm tuple|Rect||Tuple of 4 ints specifying the position (left, top, right, bottom)
--- 3299,3303 ----
int DrawText(
HDC hDC, // @pyparm int/<o PyHANDLE>|hDC||The device context on which to draw
! TCHAR *INPUT, // @pyparm str|String||The text to be drawn
int nCount, // @pyparm int|nCount||The number of characters, use -1 for simple null-terminated string
RECT *BOTH, // @pyparm tuple|Rect||Tuple of 4 ints specifying the position (left, top, right, bottom)
***************
*** 3243,3246 ****
--- 3322,3327 ----
// @pyswig |CreateSolidBrush|
HBRUSH CreateSolidBrush(COLORREF color);
+ // @pyswid |CreatePen|
+ HPEN CreatePen(int fnPenStyle, int nWidth, COLORREF crColor);
// @pyswig |GetSysColor|
DWORD GetSysColor(int nIndex);
***************
*** 3249,3256 ****
--- 3330,3341 ----
// @pyswig |InvalidateRect|
BOOLAPI InvalidateRect(HWND hWnd, RECT *INPUT_NULLOK , BOOL bErase);
+ #ifndef MS_WINCE
// @pyswig |FrameRect|
int FrameRect(HDC hDC, RECT *INPUT, HBRUSH hbr);
+ #endif /* not MS_WINCE */
// @pyswig |GetUpdateRgn|
int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase);
+ // @pyswig |Rectangle|
+ BOOLAPI Rectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
// @pyswig hdc, paintstruct|BeginPaint|
***************
*** 3307,3313 ****
--- 3392,3400 ----
);
+ #ifndef MS_WINCE
// @pyswig |IsIconic|determines whether the specified window is minimized (iconic).
BOOL IsIconic( HWND hWnd // @pyparm int|hWnd||handle to window
);
+ #endif /* not MS_WINCE */
***************
*** 3328,3334 ****
--- 3415,3424 ----
// @pyswig |SetCapture|Captures the mouse for the specified window.
HWND SetCapture(HWND hWnd);
+
+ #ifndef MS_WINCE
// @pyswig |_TrackMouseEvent|Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.
// @pyparm <o TRACKMOUSEEVENT>|tme||
BOOLAPI _TrackMouseEvent(TRACKMOUSEEVENT *INPUT);
+ #endif
// @pyswig int|ReleaseDC|Releases a device context.
***************
*** 3529,3533 ****
{
HWND hwnd;
! char buf[256];
// @pyparm int|hwnd||The handle to the window
if (!PyArg_ParseTuple(args, "i:GetClassName", &hwnd))
--- 3619,3623 ----
{
HWND hwnd;
! TCHAR buf[256];
// @pyparm int|hwnd||The handle to the window
if (!PyArg_ParseTuple(args, "i:GetClassName", &hwnd))
***************
*** 3537,3541 ****
if (nchars==0)
PyWin_SetAPIError("GetClassName");
! return PyString_FromStringAndSize(buf, nchars);
}
%}
--- 3627,3631 ----
if (nchars==0)
PyWin_SetAPIError("GetClassName");
! return PyWinObject_FromTCHAR(buf, nchars);
}
%}
***************
*** 3551,3554 ****
--- 3641,3645 ----
HWND ChildWindowFromPoint(HWND INPUT, POINT INPUT);
+ #ifndef MS_WINCE
// @pyswig int|ChildWindowFromPoint|Determines which, if any, of the child windows belonging to a parent window contains the specified point.
// @pyparm int|hwndParent||The parent.
***************
*** 3556,3559 ****
--- 3647,3651 ----
// @pyparm int|flags||Specifies which child windows to skip. This parameter can be one or more of the CWP_* constants.
HWND ChildWindowFromPointEx(HWND INPUT, POINT INPUT, int flags);
+ #endif
// Sorting for controls
***************
*** 3635,3638 ****
--- 3727,3745 ----
return Py_None;
}
+ #else // PYVERSION
+ static PyObject *PyListView_SortItems(PyObject *self, PyObject *args)
+ {
+ PyErr_SetString(PyExc_NotImplementedError,
+ "This requires Python 2.3 or greater");
+ return NULL;
+ }
+ #endif // PYVERSION 2.3+
+ %}
+
+ %native (ListView_SortItems) PyListView_SortItems;
+
+ #ifndef MS_WINCE
+ %{
+ #if (PY_VERSION_HEX >= 0x02030000) // PyGILState only in 2.3+
// @pyswig |ListView_SortItemsEx|Uses an application-defined comparison function to sort the items of a list view control.
static PyObject *
***************
*** 3669,3707 ****
return NULL;
}
! static PyObject *PyListView_SortItems(PyObject *self, PyObject *args)
! {
! PyErr_SetString(PyExc_NotImplementedError,
! "This requires Python 2.3 or greater");
! return NULL;
! }
! #endif // PYVERSION 2.3+
%}
-
- %native (ListView_SortItems) PyListView_SortItems;
%native (ListView_SortItemsEx) PyListView_SortItemsEx;
! // @pyswig int|CreateDC|Creates a device context for a printer or display device
! %native (CreateDC) PyCreateDC;
! %{
! static PyObject *PyCreateDC(PyObject *self, PyObject *args)
{
! PDEVMODE pdevmode;
! PyObject *obdevmode=NULL;
! char *driver, *device, *dummyoutput=NULL;
! HDC hdc;
! // @pyparm string|Driver||Name of display or print provider, usually DISPLAY or WINSPOOL
! // @pyparm string|Device||Name of specific device, eg printer name returned from GetDefaultPrinter
! // @pyparm <o PyDEVMODE>|InitData||A PyDEVMODE that specifies printing parameters, use None for printer defaults
! if (!PyArg_ParseTuple(args, "szO", &driver, &device, &obdevmode))
! return NULL;
! if (!PyWinObject_AsDEVMODE(obdevmode, &pdevmode, TRUE))
! return NULL;
! hdc=CreateDC(driver, device, dummyoutput, pdevmode);
! if (hdc!=NULL)
! return Py_BuildValue("l",hdc);
! PyWin_SetAPIError("CreateDC",GetLastError());
return NULL;
}
! %}
%{
--- 3776,3800 ----
return NULL;
}
! #endif // PYVERSION
%}
%native (ListView_SortItemsEx) PyListView_SortItemsEx;
+ #endif // !MS_WINCE
! %typemap(python,in) DEVMODE *INPUT
{
! if(!PyWinObject_AsDEVMODE($source, &$target, TRUE))
return NULL;
}
!
! %typemap(python,arginit) DEVMODE *
! {
! $target = NULL;
! }
!
! // @pyswig int|CreateDC|Creates a device context for a printer or display device
! // @pyparm string|Driver||Name of display or print provider, usually DISPLAY or WINSPOOL
! // @pyparm string|Device||Name of specific device, eg printer name returned from GetDefaultPrinter
! // @pyparm <o PyDEVMODE>|InitData||A PyDEVMODE that specifies printing parameters, use None for printer defaults
! HDC CreateDC(TCHAR *INPUT_NULLOK, TCHAR *INPUT_NULLOK, TCHAR *INPUT, DEVMODE *INPUT);
%{
***************
*** 3941,3945 ****
--- 4034,4040 ----
BOOL boolParam;
UINT uintParam;
+ #ifndef MS_WINCE
long longParam;
+ #endif
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k|Ok", keywords,
***************
*** 3951,3954 ****
--- 4046,4050 ----
// @flagh Action|Input/return type
switch (Action){
+ #ifndef MS_WINCE
// @flag SPI_GETDESKWALLPAPER|Returns the path to the bmp used as wallpaper
case SPI_GETDESKWALLPAPER:
***************
*** 4036,4039 ****
--- 4132,4136 ----
// @flag SPI_GETSCREENREADER|Returns a boolean
case SPI_GETSCREENREADER:
+ #endif // !MS_WINCE
// @flag SPI_GETSHOWSOUNDS|Returns a boolean
case SPI_GETSHOWSOUNDS:
***************
*** 4041,4044 ****
--- 4138,4142 ----
break;
+ #ifndef MS_WINCE
// Actions in this section accept a boolean as pvParam
// @flag SPI_SETDROPSHADOW|Param must be a boolean
***************
*** 4115,4118 ****
--- 4213,4217 ----
// @flag SPI_SETSCREENREADER|Param is a boolean
case SPI_SETSCREENREADER:
+ #endif // !MS_WINCE
// @flag SPI_SETSHOWSOUNDS|Param is a boolean
case SPI_SETSHOWSOUNDS:
***************
*** 4122,4130 ****
--- 4221,4232 ----
break;
+ #ifndef MS_WINCE
// These accept an int placed in uiParam
// @flag SPI_SETMOUSETRAILS|Param should be an int specifying the nbr of cursors in the trail (0 or 1 means disabled)
case SPI_SETMOUSETRAILS:
+ #endif // !MS_WINCE
// @flag SPI_SETWHEELSCROLLLINES|Param is an int specifying nbr of lines
case SPI_SETWHEELSCROLLLINES:
+ #ifndef MS_WINCE
// @flag SPI_SETKEYBOARDDELAY|Param is an int in the range 0 - 3
case SPI_SETKEYBOARDDELAY:
***************
*** 4157,4160 ****
--- 4259,4263 ----
// @flag SPI_SETBORDER|Param is an int
case SPI_SETBORDER:
+ #endif // !MS_WINCE
if (!PyObject_AsUINT(obParam, &uiParam))
goto done;
***************
*** 4164,4167 ****
--- 4267,4271 ----
// @flag SPI_GETFONTSMOOTHINGCONTRAST|Returns an int
case SPI_GETFONTSMOOTHINGCONTRAST:
+ #ifndef MS_WINCE
// @flag SPI_GETFONTSMOOTHINGTYPE|Returns an int
case SPI_GETFONTSMOOTHINGTYPE:
***************
*** 4182,4187 ****
--- 4286,4293 ----
// @flag SPI_GETMOUSEHOVERTIME|Returns an int
case SPI_GETMOUSEHOVERTIME:
+ #endif // !MS_WINCE
// @flag SPI_GETSCREENSAVETIMEOUT|Returns an int (idle time in seconds)
case SPI_GETSCREENSAVETIMEOUT:
+ #ifndef MS_WINCE
// @flag SPI_GETMENUSHOWDELAY|Returns an int (shortcut delay in milliseconds)
case SPI_GETMENUSHOWDELAY:
***************
*** 4206,4209 ****
--- 4312,4316 ----
// @flag SPI_GETMOUSECLICKLOCKTIME|Returns an int (in milliseconds)
case SPI_GETMOUSECLICKLOCKTIME:
+ #endif // !MS_WINCE
pvParam=&uintParam;
break;
***************
*** 4212,4215 ****
--- 4319,4323 ----
// @flag SPI_SETFONTSMOOTHINGCONTRAST|Param should be an int in the range 1000 to 2200
case SPI_SETFONTSMOOTHINGCONTRAST:
+ #ifndef MS_WINCE
// @flag SPI_SETFONTSMOOTHINGTYPE|Param should be one of the FE_FONTSMOOTHING* constants
case SPI_SETFONTSMOOTHINGTYPE:
***************
*** 4230,4237 ****
--- 4338,4347 ----
// @flag SPI_SETMOUSECLICKLOCKTIME|Param is an int (in milliseconds)
case SPI_SETMOUSECLICKLOCKTIME:
+ #endif // !MS_WINCE
if (!PyObject_AsUINT(obParam, (UINT *)&pvParam))
goto done;
break;
+ #ifndef MS_WINCE
// @flag SPI_GETICONTITLELOGFONT|Returns a <o PyLOGFONT>,
case SPI_GETICONTITLELOGFONT:
***************
*** 4260,4263 ****
--- 4370,4374 ----
case SPI_SETICONS:
break;
+ #endif // !MS_WINCE
// @flag SPI_GETMOUSE|Returns a tuple of 3 ints containing the x and y mouse thresholds and the acceleration factor.
***************
*** 4289,4292 ****
--- 4400,4404 ----
}
+ #ifndef MS_WINCE
// @flag SPI_GETDEFAULTINPUTLANG|Returns an int (locale id for default language)
case SPI_GETDEFAULTINPUTLANG:
***************
*** 4330,4333 ****
--- 4442,4446 ----
goto done;
break;
+ #endif // !MS_WINCE
// below are not handled yet
***************
*** 4380,4383 ****
--- 4493,4497 ----
switch (Action){
+ #ifndef MS_WINCE
case SPI_GETDESKWALLPAPER:
ret=PyWinObject_FromTCHAR((TCHAR *)pvParam);
***************
*** 4416,4426 ****
case SPI_GETMOUSEVANISH:
case SPI_GETSCREENREADER:
case SPI_GETSHOWSOUNDS:
ret=PyBool_FromLong(boolParam);
break;
! case SPI_GETFONTSMOOTHINGCONTRAST:
case SPI_GETFONTSMOOTHINGTYPE:
case SPI_GETMOUSETRAILS:
- case SPI_GETWHEELSCROLLLINES:
case SPI_GETKEYBOARDDELAY:
case SPI_GETKEYBOARDSPEED:
--- 4530,4540 ----
case SPI_GETMOUSEVANISH:
case SPI_GETSCREENREADER:
+ #endif // !MS_WINCE
case SPI_GETSHOWSOUNDS:
ret=PyBool_FromLong(boolParam);
break;
! #ifndef MS_WINCE
case SPI_GETFONTSMOOTHINGTYPE:
case SPI_GETMOUSETRAILS:
case SPI_GETKEYBOARDDELAY:
case SPI_GETKEYBOARDSPEED:
***************
*** 4429,4433 ****
case SPI_GETMOUSEHOVERWIDTH:
case SPI_GETMOUSEHOVERTIME:
- case SPI_GETSCREENSAVETIMEOUT:
case SPI_GETMENUSHOWDELAY:
case SPI_GETLOWPOWERTIMEOUT:
--- 4543,4546 ----
***************
*** 4441,4446 ****
--- 4554,4564 ----
case SPI_GETFOCUSBORDERWIDTH:
case SPI_GETMOUSECLICKLOCKTIME:
+ #endif // !MS_WINCE
+ case SPI_GETFONTSMOOTHINGCONTRAST:
+ case SPI_GETWHEELSCROLLLINES:
+ case SPI_GETSCREENSAVETIMEOUT:
ret=PyLong_FromUnsignedLong(uintParam);
break;
+ #ifndef MS_WINCE
case SPI_GETDEFAULTINPUTLANG:
ret=PyLong_FromLong(longParam);
***************
*** 4449,4455 ****
--- 4567,4575 ----
ret=new PyLOGFONT((LOGFONT *)pvParam);
break;
+ #endif // !MS_WINCE
case SPI_GETMOUSE:
ret=Py_BuildValue("kkk", ((UINT *)pvParam)[0], ((UINT *)pvParam)[1], ((UINT *)pvParam)[2]);
break;
+ #ifndef MS_WINCE
case SPI_GETANIMATION:
ret=PyInt_FromLong(((ANIMATIONINFO *)pvParam)->iMinAnimate);
***************
*** 4465,4468 ****
--- 4585,4589 ----
}
break;
+ #endif // !MS_WINCE
default:
***************
*** 4473,4482 ****
done:
switch (Action){
case SPI_GETDESKWALLPAPER:
case SPI_GETICONTITLELOGFONT:
- case SPI_GETMOUSE:
- case SPI_SETMOUSE:
case SPI_GETANIMATION:
case SPI_SETANIMATION:
if (pvParam!=NULL)
free(pvParam);
--- 4594,4605 ----
done:
switch (Action){
+ #ifndef MS_WINCE
case SPI_GETDESKWALLPAPER:
case SPI_GETICONTITLELOGFONT:
case SPI_GETANIMATION:
case SPI_SETANIMATION:
+ #endif // !MS_WINCE
+ case SPI_GETMOUSE:
+ case SPI_SETMOUSE:
if (pvParam!=NULL)
free(pvParam);
|