FPC_SetPreProcessURLHandler

Syntax

typedef void (WINAPI *PPREPROCESSURLHANDLER)(
  HFPC hFPC,
  LPARAM lParam,
  LPWSTR* pszURL,
  BOOL* pbContinue
);
 
DWORD WINAPI FPC_SetPreProcessURLHandler(
  HFPC hFPC,
  PPREPROCESSURLHANDLER pHandler,
  LPARAM lParam
);

Description

The FPC_SetPreProcessURLHandler function sets a global handler that is called every time Flash attempts to access a URL. This can occur when loading a movie, requesting an external resource, or when a user clicks a link inside a Flash movie.

The handler can either:

  • Cancel the request by setting *pbContinue = FALSE.
  • Redirect the request by changing the passed URL, e.g. *pszURL = L"http://another_url".

This allows you to filter, block, or substitute resources before Flash processes them.

Example

// Example of setting a preprocess URL handler
DWORD g_dwHandlerCookie;
 
HRESULT WINAPI PreProcessURLHandler(HFPC hFPC, LPARAM lParam, LPWSTR* pszURL, BOOL* pbContinue)
{
    if (wcsstr(*pszURL, L"blockedsite.com"))
    {
        // Block navigation to this URL
        *pbContinue = FALSE;
        return S_OK;
    }
 
    if (wcsstr(*pszURL, L"oldpath/movie.swf"))
    {
        // Redirect to another URL
        *pszURL = L"http://newserver.com/newmovie.swf";
    }
 
    return S_OK;
}
 
...
 
g_dwHandlerCookie = FPC_SetPreProcessURLHandler(hFPC, &PreProcessURLHandler, 0);