22// $Id$
33
44// Implements wrappers for the Property System functions and interfaces.
5- // These interfaces are present on Windows Vista and later, but can also
6- // be installed on XP with Desktop Search 3.
7- // However, this module doeen't dynamically load any libraries or functions,
8- // so it will fail to import if the components are not installed.
95
106// This source file contains autoduck documentation.
117// @doc
3834#include " propvarutil.h"
3935#include " Shobjidl.h"
4036
41- #define CHECK_PFN (fname ) \
42- if (pfn##fname == NULL ) \
43- return PyErr_Format(PyExc_NotImplementedError, " %s is not available on this platform" , #fname);
44- // Not available on Vista or earlier
45- typedef HRESULT (WINAPI *PFNSHGetPropertyStoreForWindow)(HWND, REFIID, void **);
46- static PFNSHGetPropertyStoreForWindow pfnSHGetPropertyStoreForWindow = NULL ;
47-
4837// @object PyPROPERTYKEY|A tuple of a fmtid and property id (IID, int) that uniquely identifies a property
4938BOOL PyWinObject_AsPROPERTYKEY (PyObject *obkey, PROPERTYKEY *pkey)
5039{
@@ -390,12 +379,10 @@ static PyObject *PyPSLookupPropertyHandlerCLSID(PyObject *self, PyObject *args)
390379};
391380
392381// @pymethod <o PyIPropertyStore>|propsys|SHGetPropertyStoreForWindow|Retrieves a collection of a window's properties
393- // @comm Requires Windows 7 or later.
394382// @rdesc The returned store can be used to set the System.AppUserModel.ID property that determines how windows
395383// are grouped on the taskbar
396384static PyObject *PySHGetPropertyStoreForWindow (PyObject *self, PyObject *args)
397385{
398- CHECK_PFN (SHGetPropertyStoreForWindow);
399386 HWND hwnd;
400387 IID riid = IID_IPropertyStore;
401388 void *ret;
@@ -407,7 +394,7 @@ static PyObject *PySHGetPropertyStoreForWindow(PyObject *self, PyObject *args)
407394
408395 HRESULT hr;
409396 PY_INTERFACE_PRECALL;
410- hr = (*pfnSHGetPropertyStoreForWindow) (hwnd, riid, &ret);
397+ hr = SHGetPropertyStoreForWindow (hwnd, riid, &ret);
411398 PY_INTERFACE_POSTCALL;
412399 if (FAILED (hr))
413400 return PyCom_BuildPyException (hr);
@@ -546,7 +533,7 @@ static PyObject *PySHSetDefaultProperties(PyObject *self, PyObject *args)
546533}
547534
548535/* List of module functions */
549- // @module propsys|A module, encapsulating the Vista Property System interfaces
536+ // @module propsys|A module, encapsulating the Property System interfaces
550537static struct PyMethodDef propsys_methods[] = {
551538 // { "SHGetPropertyStoreFromIDList", PySHGetPropertyStoreFromIDList, 1 }, // @pymeth
552539 // SHGetPropertyStoreFromIDList|Retrieves the property store from an absolute ID list
@@ -618,10 +605,7 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = {
618605/* Module initialisation */
619606PYWIN_MODULE_INIT_FUNC (propsys)
620607{
621- PYWIN_MODULE_INIT_PREPARE (propsys, propsys_methods,
622- " A module, encapsulating the Property System interfaces."
623- " Available on Windows Vista and later, but can also be used"
624- " on XP if Desktop Search 3 is installed." );
608+ PYWIN_MODULE_INIT_PREPARE (propsys, propsys_methods, " A module, encapsulating the Property System interfaces." );
625609
626610 if (PyDict_SetItemString (dict, " error" , PyWinExc_COMError) == -1 )
627611 PYWIN_MODULE_INIT_RETURN_ERROR;
@@ -636,10 +620,5 @@ PYWIN_MODULE_INIT_FUNC(propsys)
636620 sizeof (g_interfaceSupportData) / sizeof (PyCom_InterfaceSupportInfo)) != 0 )
637621 PYWIN_MODULE_INIT_RETURN_ERROR;
638622
639- HMODULE hmod = GetModuleHandle (L" shell32.dll" );
640- if (hmod)
641- pfnSHGetPropertyStoreForWindow =
642- (PFNSHGetPropertyStoreForWindow)GetProcAddress (hmod, " SHGetPropertyStoreForWindow" );
643-
644623 PYWIN_MODULE_INIT_RETURN_SUCCESS;
645624}
0 commit comments