Поделиться через


IWPCBlockedUrls::GetUrl method

Note  The Internet Ratings API is deprecated, and will be removed in a future release. Use Windows 8 Family Safety feature instead.

 

Gets the blocked URL at the specified index.

Syntax

HRESULT GetUrl(
  [in]  DWORD dwIdx,
  [out] BSTR      *pbstrUrl
);

Parameters

  • dwIdx [in]
    A DWORD that specifies the index.

  • pbstrUrl [out]
    A BSTR variable that receives the URL.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

GetUrl was introduced in Windows Internet Explorer 7.

The caller is responsible for freeing the string with SysFreeString.

Examples

The following example copies the entire list of a blocked URLs into an array.

HRESULT           hr;
IWPCBlockedUrls   pBlockedUrls;

// Query the service provider for IWPCBlockedUrls
hr = _psp->QueryService(IID_IWPCBlockedUrls, IID_PPV_ARGS(&pBlockedUrls));
if (SUCCEEDED(hr))
{
    DWORD  dwCount;
    if (SUCCEEDED(pBlockedUrls->GetCount(&dwCount)) && (dwCount>0))
    {
        BSTR * pargUrls = (BSTR*) LocalAlloc(LPTR, dwCount*sizeof(BSTR*));

        if (NULL != pargUrls)
        {
            BSTR * pbstrUrl = pargUrls;
            
            // Retrieve URLs into pointer array
            for (DWORD dwIdx=0; dwIdx < dwCount; dwIdx++)
            {
                hr = pBlockedUrls->GetUrl(dwIdx, pbstrUrl);
                if (FAILED(hr)) break;
                pbstrUrl++;
            }
            
            // *** Use the list of URLs here
            
            // Free array and elements
            pbstrUrl = pargUrls;
            for (DWORD dwIdx=0; dwIdx < dwCount; dwIdx++)
            {
                if (!*pbstrUrl) break;
                SysFreeString(*pbstrUrl);
                pbstrUrl++;
            }
            LocalFree(pargUrls);                        
        }
        else
            hr = E_OUTOFMEMORY;
    }
    pBlockedUrls->Release();
}

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Product

Internet Explorer 7

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Shdocvw.dll

See also

IWPCBlockedUrls

GetCount