首页
社区
课程
招聘
[求助]OCX怎么注册协议?比如QQ的Tencent://
发表于: 2009-2-18 18:33 5636

[求助]OCX怎么注册协议?比如QQ的Tencent://

2009-2-18 18:33
5636
当点击网页上的连接为 Tencent://的连接时 自动打开QQ

这样子的原理OCX中是怎么实现的呢? 请大家解释一下,谢谢了 ~

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (13)
雪    币: 190
活跃值: (10)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
2
ACTIVEX??????????
2009-2-18 18:58
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
好像是 ACTIVEX~~~ 但是不知道怎么样才能注册成能够调用那种连接的方式
2009-2-19 01:18
0
雪    币: 196
活跃值: (135)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
4
首先在注册表中注册一个URL Protocol.
然后在OCX中实现IURLSearchHook接口.

这样在遇到未知协议时,它就会依次调用IURLSearchHook::Translate(...)直到最后.
2009-2-19 11:29
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
thinkSJ 的回答对偶很有帮助. 非常谢谢您
2009-2-19 11:36
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
IURLSearchHook


The IURLSearchHook interface is used by the browser to translate the address of an unknown URL protocol. When attempting to browse to a URL address that does not contain a protocol, the browser will first attempt to determine the correct protocol from the address. If this is not successful, the browser will create URL Search Hook objects and call each object's Translate method until the address is translated or all of the hooks have been queried. 

URL Search Hooks are registered by adding a value that contains the object's CLSID string under the following key in the registry: 

HKEY_LOCAL_MACHINE
   Software
      Microsoft
         Internet Explorer
            UrlSearchHooks

Remarks 

Implement this interface if your application defines a custom URL protocol and if address translation for this protocol is required. 

You do not normally use this interface; it is called by the browser. IURLSearchHook Method  Description 
Translate  Called by the browser when the browser cannot determine the protocol of a URL address. 


Requirements 
  Version 4.71 and later of Shell32.dll

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). 
  Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). 
  Header: Declared in Shlobj.h. 

IURLSearchHook::Translate


Called by the browser when the browser cannot determine the protocol of a URL address. 

HRESULT Translate(
    LPWSTR lpwszSearchURL, 
    DWORD cchBufferSize 
   );

Parameters
lpwszSearchURL 
Address of a wide character buffer that, on entry, contains the URL address for which the browser is trying to determine the protocol. On exit, this buffer contains the modified URL address if the method was successful. See the return value for more information. 
cchBufferSize 
Size, in characters, of the buffer at lpwszSearchURL. 
Return Values
This method must return one of the following values: S_OK  The URL address was completely translated. The lpwszSearchURL parameter contains the full URL address. The browser will not call any other URL Search Hooks and will attempt to browse to the modified address.  
S_FALSE  The URL address has been partially processed, but further translation is still required. The lpwszSearchURL parameter contains the result of the processing. The browser will continue executing the rest of the URL Search Hooks.  
E_FAIL  The URL address was not translated. The lpwszSearchURL parameter has not been modified. The browser will continue executing the rest of the URL Search Hooks.  


Requirements 
  Version 4.71 and later of Shell32.dll

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). 
  Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). 
  Header: Declared in Shlobj.h. 


MSDN中说此接口在Shell32.dll中   在里面翻到了很多接口.就是没有这个接口...~
2009-2-19 13:05
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
截取的图片:
上传的附件:
  • 1.jpg (14.19kb,85次下载)
2009-2-19 13:09
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
请大家帮帮忙,怎么添加 IURLSearchHook 接口?
2009-2-19 14:15
0
雪    币: 196
活跃值: (135)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
9
这里有个例子:
http://www.vckbase.com/document/viewdoc/?id=1804
2009-2-19 14:29
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
那个是全注册表操作... 先前看过了.

这个才是真正用activex挂接的 可是不知道那个接口是在哪里添加进来的.  除了手写 IDE 有地方选择加入么?

thinkSJ 谢谢你的多次帮忙~~   但是还是想继续研究一下那些接口在哪里加的.
上传的附件:
2009-2-19 14:44
0
雪    币: 196
活跃值: (135)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
11
我的ATL工程所继承的标准接口都是手动添加的,
从VC6 到 VC8都没找到添加的地方.
你仔细找找, 有的话,回贴吼一声,好让我膜拜下. :)
2009-2-19 15:00
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
那我就吼了啊...

!!~~~ ~~~   婉转悠扬中...~~~
上传的附件:
  • 1.gif (136.59kb,74次下载)
2009-2-19 15:11
0
雪    币: 196
活跃值: (135)
能力值: ( LV10,RANK:170 )
在线值:
发帖
回帖
粉丝
13
呵呵....膜拜~!
2009-2-19 15:52
0
雪    币: 4200
活跃值: (4178)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14
偶膜拜您啊~~~...  我不会手加啊~~
2009-2-19 16:45
0
游客
登录 | 注册 方可回帖
返回
//