There are times in everyone’s life where you would have thought
about customizing things that you are forced to use the pre-defined one. A
custom made browser, an extension that you can call your own, your own IDE (Interface
Development Environment) and so on.
If you have thought about creating your very own protocol on the
line of http, https, etc. you have come to the right place.
You can create your own protocols and name it whatever you like,
myprotocol, tiger, etc. and use the custom protocol in a similar way as http –
tiger://google.com.
Microsoft provides an excellent way to help you create your own
protocols. Enter Asynchronous Pluggable Protocols. Asynchronous Pluggable
Protocols helps developers to create their own protocols; MIME filters that work
with Microsoft’s Internet Explorer from version 4.0 and above.
You need to implement the IInterProtocolInfo interface for this
purpose. Override the methods provided by this interface. One of the methods is
ParseUrl; use this method to parse the URL, whether you are interested in
processing it further. ParseUrl
has the following form.
HRESULT ParseUrl(
LPCWSTR pwzUrl,
PARSEACTION ParseAction,
DWORD dwParseFlags,
LPWSTR pwzResult,
DWORD cchResult,
DWORD *pcchResult,
DWORD dwReserved
);
The most important parameter is PARSEACTION, your methods needs to
include switch case for each of the PARSEACTIONS.
The next important method is QueryInfo method. Use this method to
decide which URL you wish to mark secured and others that you want to mark
insecure so that the users of your application are notified about the same. QueryInfo
has the following form
HRESULT QueryInfo(
LPCWSTR pwzUrl,
QUERYOPTION OueryOption,
DWORD dwQueryFlags,
LPVOID pBuffer,
DWORD cbBuffer,
DWORD *pcbBuf,
DWORD dwReserved
);
Here the important parameter is QUERYOPTION. If you want your URL to pass through the IE security filter, then return TRUE for QUERY_CAN_NAVIGATE and QUERY_IS_SECURE.
No comments:
Post a Comment