Home COM GDI+ WebBrowser Data Access

IEnumSTATURL  Interface

 

IID_IEnumSTATURL

{3C374A42-BAE4-11CF-BF7D-00AA006946EE}

 

 

This interface enumerates the items in the history cache.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IEnumSTATURL Methods

Description

Next

Searches the history for any URL that matches the search pattern and copies it to the specified buffer.

Skip

Not currently implemented.

Reset

Resets the enumerator interface so that it begins enumerating at the beginning of the history.

Clone

Not currently implemented.

SetFilter

IEnumSTATURL::Next compares the specified URL with each URL in the history list to find matches. IEnumSTATURL::Next then copies the list of matches to a buffer. This method is used to specify the URL to compare.

 

Next

 

FUNCTION IEnumSTATURL_Next ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL celt AS DWORD _
, BYREF rgelt AS STATURL _
, BYREF pceltFetched AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IEnumSTATURL_Next (pthis, celt, rgelt, pceltFetched) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Skip

 

FUNCTION IEnumSTATURL_Skip ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL celt AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IEnumSTATURL_Skip (pthis, celt) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Reset

 

FUNCTION IEnumSTATURL_Reset ( _
  BYVAL pthis AS DWORD PTR _
  ) AS LONG

  LOCAL HRESULT AS LONG

  CALL DWORD @@pthis[5] USING IEnumSTATURL_Reset (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Clone

 

FUNCTION IEnumSTATURL_Clone ( _
  BYVAL pthis AS DWORD PTR _
, BYREF ppenum AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG

  CALL DWORD @@pthis[6] USING IEnumSTATURL_Clone (pthis, ppenum) TO HRESULT

  FUNCTION = HRESULT

END FUNCTION

 

 

SetFilter

 

FUNCTION IEnumSTATURL_SetFilter ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL poszFilter AS STRING _
, BYVAL dwFlags AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG

  poszFilter = UCODE$(poszFilter) & $NUL

  CALL DWORD @@pthis[7] USING IEnumSTATURL_SetFilter (pthis, poszFilter, dwFlags) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Example

 


' ========================================================================================
' Enumerates the Internet Explorer History
' SED_PBCC - Use the PBCC compiler
' ========================================================================================
#COMPILE EXE
#DIM ALL
#INCLUDE "Win32Api.inc"

%CLSCTX_INPROC_SERVER = &H1

' ========================================================================================
' Contains statistics about a URL. This structure is filled by Microsoft Internet
' Explorer during calls to certain IUrlHistory interfaces.
' ========================================================================================
TYPE STATURL
   cbSize AS DWORD
   pwcsUrl AS DWORD
   pwcsTitle AS DWORD
   ftLastVisited AS FILETIME
   ftLastUpdated AS FILETIME
   ftExpires AS FILETIME
   dwFlags AS DWORD
END TYPE
' ========================================================================================

' ========================================================================================
' Decrements the reference count for the calling interface on a object. If the
' reference count on the object falls to 0, the object is freed from memory.
' ========================================================================================
FUNCTION IUrlHistoryStg2_Release (BYVAL pthis AS DWORD PTR) AS DWORD
   LOCAL DWRESULT AS DWORD
   IF ISFALSE pthis THEN EXIT FUNCTION
   CALL DWORD @@pthis[2] USING IUrlHistoryStg2_Release(pthis) TO DWRESULT
   FUNCTION = DWRESULT
END FUNCTION
' ========================================================================================

' ========================================================================================
' Returns an interface to an enumerator of the history's visited links.
' ========================================================================================
FUNCTION IUrlHistoryStg2_EnumUrls (BYVAL pthis AS DWORD PTR, BYREF ppEnum AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   IF ISFALSE pthis THEN FUNCTION = %E_POINTER : EXIT FUNCTION
   CALL DWORD @@pthis[7] USING IUrlHistoryStg2_EnumUrls (pthis, ppEnum) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ========================================================================================

' ========================================================================================
' Searches the history for any URL that matches the search pattern and copies it to the
' specified buffer.
' ========================================================================================
FUNCTION IEnumSTATURL_Next (BYVAL pthis AS DWORD PTR, BYVAL celt AS DWORD, BYREF rgelt AS STATURL, BYREF pceltFetched AS DWORD) AS LONG
   LOCAL HRESULT AS LONG
   IF ISFALSE pthis THEN FUNCTION = %E_POINTER : EXIT FUNCTION
   CALL DWORD @@pthis[3] USING IEnumSTATURL_Next (pthis, celt, rgelt, pceltFetched) TO HRESULT
   FUNCTION = HRESULT
END FUNCTION
' ========================================================================================

' ========================================================================================
' Main
' ========================================================================================
FUNCTION PBMAIN () AS LONG

   LOCAL hr AS LONG
   LOCAL pUrlHistory AS DWORD
   LOCAL CLSID_CUrlHistory AS GUID
   LOCAL IID_IUrlHistoryStg2 AS GUID
   LOCAL ppEnum AS DWORD
   LOCAL url AS STATURL
   LOCAL ulFetched AS DWORD
   LOCAL bstrlen AS DWORD
   LOCAL buffer AS STRING

   ' Creates an instance of the IUrlHistoryStg2 interface
   CLSID_CUrlHistory = GUID$("{3C374A40-BAE4-11CF-BF7D-00AA006946EE}")
   IID_IUrlHistoryStg2 = GUID$("{AFA0DC11-C313-11D0-831A-00C04FD5AE38}")
   hr = CoCreateInstance(CLSID_CUrlHistory, BYVAL %NULL, %CLSCTX_INPROC_SERVER, IID_IUrlHistoryStg2, pUrlHistory)
   IF ISTRUE pUrlHistory THEN
      ' Retrieves an interface to an enumerator of the history's visited links.
      hr = IUrlHistoryStg2_EnumUrls(pUrlHistory, ppEnum)
      IF ISTRUE ppEnum THEN
         ' Size of the STATURL structure
         url.cbsize = SIZEOF(url)
         DO
            ' Searches the history for any URL that matches the search pattern and
            ' copies it to the specified buffer.
            ' Note: If url.pwcsUrl and/or url.pwcsTitle return valid pointers,
            ' we must free them with CoTaskMemFree to avoid memory leaks.
            hr = IEnumSTATURL_Next(ppEnum, 1, url, ulFetched)
            IF hr <> %S_OK OR ulFetched = 0 THEN EXIT DO
            ' Extracts the Unicode string from the returned pointer
            IF ISTRUE url.pwcsUrl THEN
               bstrlen = lstrlenW(BYVAL url.pwcsUrl)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(url.pwcsUrl, bstrlen * 2)
                  buffer = ACODE$(buffer)
                  PRINT buffer
               END IF
               ' Frees the string
               CoTaskMemFree url.pwcsUrl
            END IF
            ' Extracts the Unicode string from the returned pointer
            IF ISTRUE url.pwcsTitle THEN
               bstrlen = lstrlenW(BYVAL url.pwcsTitle)
               IF ISTRUE bstrlen THEN
                  buffer = PEEK$(url.pwcsTitle, bstrlen * 2)
                  buffer = ACODE$(buffer)
                  PRINT buffer
               END IF
               ' Frees the string
               CoTaskMemFree url.pwcsTitle
            END IF
            WAITKEY$
         LOOP
         IUrlHistoryStg2_Release ppEnum
      END IF
      IUrlHistoryStg2_Release pUrlHistory
   END IF

   WAITKEY$

END FUNCTION
' ========================================================================================
 

 

Page last updated on Monday, 03 April 2006 19:52:28 +0200