[pywin32-checkins] pywin32/com/win32comext/shell/src shell.cpp,1.33,1.34
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Trent M. <tm...@us...> - 2005-01-28 00:24:35
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7513/shell/src Modified Files: shell.cpp Log Message: This patch to PyWin32 in March 2004 added the SHGetSettings shell API method to win32com.shell.shell without dynamically loading the DLL (because this function is only available on later versions of shell32.dll that WinNT may not have): http://cvs.sourceforge.net/viewcvs.py/pywin32/pywin32/com/win32comext/shell/src/shell.cpp?r1=1.25&r2=1.26 Index: shell.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** shell.cpp 25 Jan 2005 12:13:41 -0000 1.33 --- shell.cpp 28 Jan 2005 00:24:26 -0000 1.34 *************** *** 1516,1521 **** if (!PyArg_ParseTuple(args, "|l:SHGetSettings", &mask)) return NULL; SHELLFLAGSTATE state; ! SHGetSettings(&state, mask); PyObject *ret = PyDict_New(); CHECK_SET_VAL(SSF_DESKTOPHTML, mask, fDesktopHTML); --- 1516,1536 ---- if (!PyArg_ParseTuple(args, "|l:SHGetSettings", &mask)) return NULL; + + typedef void (WINAPI * PFNSHGetSettings)(LPSHELLFLAGSTATE, DWORD); + + // @comm This method is only available in shell version 4.71. If the + // function is not available, a COM Exception with HRESULT=E_NOTIMPL + // will be raised. If the function fails, a COM Exception with + // HRESULT=E_FAIL will be raised. + HMODULE hmod = GetModuleHandle(TEXT("shell32.dll")); + PFNSHGetSettings pfnSHGetSettings = (PFNSHGetSettings)GetProcAddress(hmod, "SHGetSettings"); + if (pfnSHGetSettings==NULL) + return OleSetOleError(E_NOTIMPL); + SHELLFLAGSTATE state; ! PY_INTERFACE_PRECALL; ! (*pfnSHGetSettings)(&state, mask); ! PY_INTERFACE_POSTCALL; ! PyObject *ret = PyDict_New(); CHECK_SET_VAL(SSF_DESKTOPHTML, mask, fDesktopHTML); |