怎样拦截IE弹出菜单?

解决方案 »

  1.   

    (axWebBrowser1.Document as IHTMLDocument2).parentWindow.execScript("document.oncontextmenu=function(){return false;}","JavaScript");
      

  2.   

    to  jinjazz(近身剪(充电中...)) :能稍微解释一下吗?不甚感激!!
      

  3.   

    可用截获Windows系统消息:凡是有你需要拦截IE弹出菜单的标题及句柄就给清掉:
    如:
    //Kill advertise windows
    static void KillADWindows()
    {
    HWND hwnd;
    char wintext[1024];
    int flag; BOOL bRet;
    WndList wndlist;
    WndList::iterator i;
    //Get All IE window
    bRet = EnumWindows(EnumWindowsProc , (LPARAM)&wndlist); //Check IE window's title
    for(i=wndlist.begin() ;i!= wndlist.end() ; i++){
    hwnd = (HWND)*i;
    ZeroMemory(wintext , 1024);
    GetWindowText(hwnd , wintext, 1023); //Check user's AD title
    list <string>::iterator k;
    char keytitle [1024] ;
    k = glSettings.titlelist.begin ();

    flag  = FALSE; 
    while(k !=glSettings.titlelist.end()){
    strcpy(keytitle , k->c_str()); LPTSTR found;
    if(glSettings.case_sensitive ==1){
    //Match case
    found = StrStr(wintext , keytitle) ;
    }else{
    found = StrStrI(wintext , keytitle) ;
    }
    if( found != NULL){
    flag  = TRUE; 
    break;
    } k++;
    }
    if(flag){
    PostMessage(hwnd , WM_SYSCOMMAND ,SC_CLOSE, 0);
    // PostMessage(hwnd , WM_CLOSE , 0, 0);
    }
    }
    }
      

  4.   

    http://blog.joycode.com/lostinet/archive/2005/02/27/45013.aspx