How to Implement custom URL protocol

Source: Internet
Author: User
Iurlsearchhook
This interface is used by the browser to convert an unknown URL protocol address. When the browser attempts to open an unknown protocol URL address, the browser first tries to get the current protocol from this address. If it fails, the browser creates a URL search hook object registered in the system and calls the translate method of each object until the address is converted or all URL search Hooks have been tried. Iurlsearchhook MethodHresult translate (lpwstr lpwszsearchurl, DWORD cchbuffersize );
Parameters:
Lpwszsearchurl
The buffer address of a wide character. The buffer contains the URL to be resolved by the browser.
If s_ OK is returned, the resolved (modified) URL is saved in the buffer zone.
Cchbuttersize
The size of the buffer to which the first parameter points, in bytes.
 
Return Value:
S_ OK: the URL is successfully converted. The lpwszsearchurl contains the converted URL. the browser will not call other URL search hook objects.
S_false: the URL is partially processed, but still needs to be parsed. The lpwszsearchurl contains
The browser will continue to call other URL search hook objects.
E_fail: the URL cannot be converted, and the lpwszsearchurl is not modified. The browser will continue to call other URL search hook objects.
 
 
For example, you can enter a URL www.csdn.net In the IE Address Bar. After the URL is successfully parsed, it will jump to the site. If this domain name does not exist, ie searches for the URL search hook object registered on the system to load and call its Translate. If s_ OK is returned for this method, the resolved (modified) URL is returned. The browser opens this URL. You can use this object to redirect the URL to another site when the user tries to open a site that does not exist. Alternatively, you can use a keyword to open a search quote. For example, if you enter MP3 in the address bar, you can use Google to search for MP3. Alternatively, create a Chinese real-name library and match the URL that the browser transfers to the library. After successful matching, the correct URL is returned.   How to register a URL search hook objectTo implement a URL search Hook, you must create a string value named clisid on the HKEY_LOCAL_MACHINE/software/Microsoft/Internet Explorer/urlsearchhooks location in the registry. Registration may have to be restarted before use. Note: When the URL is in the format of XXX: XXX, the URL search hook is not called even if the resolution fails. Applies only to MS-IE browsers and decimal browsers. Example reference: http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c1243

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.