IUniformResourceLocator I...     IUniformResourceLocator::...     IUniformResourceLocator I...    
Web Workshop (Miscellaneous)

IUniformResourceLocator::GetURL Method


Retrieves an object's URL.

Syntax

HRESULT GetURL(
    LPSTR *ppszURL
);

Parameters

ppszURL
Address of an LPSTR that will be filled in with a pointer to the object's URL. Because this method allocates memory for the string, you must instantiate an IMalloc interface and free the memory using IMalloc::Free when it is no longer needed.

Return Value

Returns one of the following values:

S_OK The object's URL was retrieved successfully.
S_FALSE The object does not have a URL associated with it. ppszURL is set to NULL.
E_OUTOFMEMORY There is not enough memory to complete the operation.
IS_E_EXEC_FAILED The URL's protocol handler failed to run.
URL_E_INVALID_SYNTAX The URL's syntax is invalid.
URL_E_UNREGISTERED_PROTOCOL The URL's protocol does not have a registered protocol handler.

Example

The following code fragment provides an example of how to allocate and free memory in order to store a pointer to an object's URL.

//  START CODE FRAGMENT
{
    // In this example, pURL is a global IUniformResourceLocator 
    // pointer.
    LPSTR lpTemp;

    hres = pURL->GetURL(&lpTemp); 
    if (SUCCEEDED(hres)){
        IMalloc* pMalloc;
        hres = SHGetMalloc(&pMalloc); 
        if (SUCCEEDED(hres)){
            pMalloc->Free(lpTemp);
            pMalloc->Release();
        }
    }
}
//  END CODE FRAGMENT


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.