Remove junk items from the default shortcut menu of IE in the Custom browser control (such as Baidu XXX search)

Source: Internet
Author: User

In the custom browser control, use some items and functions in the IE default right-click menu to remove those annoying junk items and view the source code. The method is as follows: idochostuihandler_my: showcontextmenu (DWORD dwid, point _ rpc_far * PPT,
Iunknown _ rpc_far * pcmdtreserved,
Idispatch _ rpc_far * pdispreserved)

{
Hwnd;
Ccomptr <iolecommandtarget> spct;
Ccomptr <iolewindow> spwnd;
Hresult hR = pcmdtreserved-> QueryInterface (iid_iolecommandtarget, (void **) & spct );
HR = pcmdtreserved-> QueryInterface (iid_iolewindow, (void **) & spwnd );
HR = spwnd-> getwindow (& hwnd );
Hinstance hinstshdoclc = loadlibrary (text ("shdoclc. dll "));

If (hinstshdoclc = NULL)
{
// Loading module error -- use the default browser control for handling
Return e_notimpl;
}
Hmenu = loadmenu (hinstshdoclc, makeintresource (24641 ));
Hmenu = getsubmenu (hmenu, dwid );
Int num = getmenuitemcount (hmenu );
Uint ID;
For (INT I = num-1; I>-1; I --) // delete all other menus {
Id = getmenuitemid (hmenu, I );
If (ID = 16 | id = 15 | id = 26 | id = 31 | id = 2270 | id = 17) continue; // retain cut, copy, paste, select all, save the image as, delete
If (ID> 2379 & id <2387) break; // vertical scroll bar: Scroll up, down, up, down, scroll up
If (ID> 2386 & amp; id <2393) break; // horizontal scroll bar

Deletemenu (hmenu, ID, mf_bycommand );
}
If (getmenuitemcount (hmenu)> 0)
{
// Display the shortcut menu
Int iselection =: trackpopupmenu (hmenu, tpm_leftalign | tpm_rightbutton | tpm_returncmd,
PPT-> X, PPT-> Y, 0, hwnd, (rect *) null );

// Send the command of the selected shortcut menu item to the shell
Lresult LR =: sendmessage (hwnd, wm_command, iselection, null );
}
Freelibrary (hinstshdoclc );
Return s_ OK;
}

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.