[pywin32-bugs] [ pywin32-Patches-1377153 ] Improved Windows CE support
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2005-12-13 21:49:36
|
Patches item #1377153, was opened at 2005-12-10 01:26 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551956&aid=1377153&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Luke Dunstan (infidel) Assigned to: Nobody/Anonymous (nobody) Summary: Improved Windows CE support Initial Comment: Some changes to allow pywintypes, win32gui, win32event and win32process to compile for Windows CE. Tested with MS eMbedded Visual C++ 4.0 with the Pocket PC 2003 SDK. This is still a work in progress. ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2005-12-14 08:49 Message: Logged In: YES user_id=14198 Thanks for that. When you submitted the patch, you mentioned "This is still a work in progress." Do you think you will have an update any time soon? ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2005-12-14 00:43 Message: Logged In: YES user_id=30442 Yes, I tried to explain but not clearly enough. That particular #ifdef is incorrect, it should be like: #ifndef MS_WINCE if (index==-1) { nicons = (int)ExtractIconEx(fname, index, NULL, NULL, 0); PyWinObject_FreeTCHAR(fname); return PyInt_FromLong(nicons); } #endif because -1 does not have this special meaning. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2005-12-13 08:39 Message: Logged In: YES user_id=14198 I'm still not quite with you on the handling of the "-1, NULL, NULL" case. I agree that the docs are not particularly clear, but I see nothing in the docs that means you should force the result to 1 in that case - the way I read it, your code will *always* return 1 in the "-1, NULL, NULL" case, regardless of what Windows actually returned. Further, the comment appears incorrect - if the API actually returns a HICON but your implementation always returns 1, then presumably the hicon returned has been lost? +#ifdef MS_WINCE + /* On WinCE >= 2.1 the API actually returns a HICON */ + nicons = 1; +#endif + PyWinObject_FreeTCHAR(fname); return PyInt_FromLong(nicons); ---------------------------------------------------------------------- Comment By: Luke Dunstan (infidel) Date: 2005-12-13 02:19 Message: Logged In: YES user_id=30442 * You are correct about the format string * Regarding the return value: "For Windows CE versions 2.10 and later, this function returns the handle to an icon. If both phiconLarge and phiconSmall are not NULL, the return value defaults to the large icon. For Windows CE versions 1.0 through 2.01, this function returns a UINT data type. If the nIconIndex parameter is â 1, the phiconLarge parameter is NULL, and the phiconSmall parameter is NULL, then the return value is the number of icons contained in the specified file. Otherwise, the return value is the number of icons successfully extracted from the file." My reading is that the whole of the second paragraph only applies to WinCE <= 2.01. The earlier description of nIconIndex supports this: "For Windows CE versions 2.10 and later, the nIconIndex parameter must be zero or âN, where N is a specified resource identifier." This implies that -1 means "the resource ID 1" for WinCE >= 2.10. This probably also means that my patch should have excluded the whole if(index==-1) { ... } block for MS_WINCE. Also, it would not make much sense to return the number of icons since nIcons must be 1. In theory we could use #if to check the WinCE version but I prefer to leave that to someone who actually develops for old versions of WinCE. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2005-12-12 16:15 Message: Logged In: YES user_id=14198 This looks quite good - thanks! A few questions about ExtractIconEx: * It appears first char of the format string passed to PyArg_ParseTuple should be changed from "s" to "O"? * The block: if (index==-1) { nicons = (int)ExtractIconEx(fname, index, NULL, NULL, 0); #ifdef MS_WINCE /* On WinCE >= 2.1 the API actually returns a HICON */ nicons = 1; #endif Isn't clear to me. My reading of the MSDN documentation for CE says that the (-1, NULL, NULL case does correctly return the number of icons in the DLL. Can you please clarify? Thanks! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551956&aid=1377153&group_id=78018 |