Geoff Chappell - Software Analyst
Given an arbitrary interface pointer to an object, this function calls the object’s GetWindow method.
HRESULT IUnknown_GetWindow ( IUnknown *punk, HWND *phwnd);
The punk argument is any interface pointer for the object of interest.
The phwnd argument is for the object’s GetWindow method.
The function returns zero for success, else an error code.
The object is expected to implement at least one of the following interfaces: IOleWindow, IInternetSecurityMgrSite, and IShellView.
If the punk argument is NULL, then there is no object to query for the expected interfaces, and the function returns E_FAIL. Interfaces are queried in the order given above. If the object does not implement any of the expected interfaces, the function returns the result of its last call to QueryInterface.
Once the function has obtained a pointer to an expected interface for the given object, it uses this interface pointer to call the GetWindow method. The phwnd argument is passed as given. The function then releases the interface pointer. The result of calling the method becomes the result of the function.
The IUnknown_GetWindow function is exported from SHLWAPI.DLL as ordinal 172 in version 5.00 and higher.
Though this function dates from as long ago as 1999, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.
However, the function did eventually get documented, apparently later in 2004. This article now conforms to Microsoft’s nomenclature.