How to use vb6.0 to achieve Chinese real-name search

Source: Internet
Author: User
Tags implement interface uuid
The Chinese language is to find a middle layer, so that he translated into VB can know the thing, not to say nonsense, began slightly

Chinese real name is nothing more than the use of IE Iurlsearchhook, but 3721 is not so play, he is using API hook to intercept IE Commbox message,,, you simply can not get him,, hey,, 3721 Sinister put, although we can not achieve the global hook, In VB can only use sub class subclass technology, this thing we do not finish, we play another

We first want to implement IObjectWithSite, IUnknown these two interfaces,

We need to create a ODL file, through which to create a TLB

[
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 (00000000-0000-0000-c000-000000000046),
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 Odl then, create a TLB file with typelib, and we'll refer to the file after it's created.

Add the following code

Implements Iobjectwithsitetlb.iobjectwithsite
Dim WithEvents IE as InternetExplorer
Dim M_site as Iunknownvb

Private Sub Iobjectwithsite_getsite (ByVal priid as Iobjectwithsitetlb.guidptr, ppvobj as Iobjectwithsitetlb.voidptr)
M_site.queryinterface Priid, Ppvobj
End Sub

Private Sub Iobjectwithsite_setsite (ByVal psite as IOBJECTWITHSITETLB.IUNKNOWNVB)
Set M_site = Psite
Set IE = Psite
End Sub

We have now implemented these two interfaces, in order to achieve our Chinese search, we can not use the Urlsearchhook

So we implement our functions through interface InternetExplorer.

Private Sub Ie_beforenavigate2 (ByVal pdisp as Object, URL as Variant, Flags as Variant, Targetframename as Variant, POSTDA Ta As Variant, Headers as Variant, Cancel as Boolean

Here to fill in the code you need,.
End Sub

The concrete is not much to say, ... Guys, look at this.

You need to add the inside of the brow Help object to the registry, and the name for this COM classid








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.