It is easy to implement in C , because C can manipulate the pointer, but VB is not very good to play this, so it needs to be implemented by class library.
To put it bluntly, it is to find an intermediate layer. Let him translate the play in VB to know, do not say nonsense, start
The Chinese real name is nothing more than IE's Iurlsearchhook, but 3721 can be so played, he is using the API Hook to intercept IE Commbox news, and you are almost him, 嘿嘿, 3721 ineffective, although we can't To achieve global hooks, only SUB Class sub-technology can only be used in VB, and we are not finished with this thing.
We must first implement two interfaces of IObjectWithsite, IUNKNOWN,
We need to create an ODL file, create a TLB through it
[Uuid (CF9D9B76-EC4B-470D-99DC-AEC6F36A9261), helpstring ( "VB IObjectWithSite Interface"), version (1.0)] library IObjectWithSiteTLB {importlib ( "stdole2.tlb"); typedef [public] long GUIDPtr; typedef [public ] Long voidptr; [UUID (00 00000000046), ODL] Interface iUnknownvb {HRESULT Queryinterface ([in] guidptr priid, [out] voidptr * pvobj); long addref (); long release (); } [uuid (FC4801A3-2BA9-11CF-A229-00AA003D7352), odl] interface IObjectWithSite: IUnknown {typedef IObjectWithSite * LPOBJECTWITHSITE; HRESULT SetSite ([in] IUnknownVB * pSite); HRESULT GetSite ([in] GUIDPtr priid, [in, OUT] voidptr * ppvobj);}};
Save it as an ODL, create a TLB file with TypeLib, and we reference this file after creating
Add the following code
Implements IObjectWithsiteTlb.iObjectWithsiteDim Withevents IE As InterneTexplorerdim M_Site as iUnknownvb
Private sub iObjectwithsite_getsite (byval prizTr) m_site.queryinterface priid, PPVOBJEND SUB
Private sub iobjectwithsite_setsite (byval psite as ipjectwithsiteetlb.iunknownvb) set m_site = psite set e = psiteend sub
We have now realized these two interfaces, in order to achieve our Chinese search, we can't use Urlsearchhook
So we are to achieve our function Private Sub IE_BeforeNavigate2 (ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) through an interface InternetExplorer
Here you fill in the code you need,. End Sub
There is not much to say,. . Everyone is watching
You need to add the brow help object of the registry, the name is ClassID of this COM.