據說可以將Activex控制項在IE中不顯示安全提示

2021-04-12 13:10:00 字數 2079 閱讀 2518

據說可以將activex控制項在ie中不顯示安全提示,先收藏,有空再驗證。

轉csdn網友shepherds()

//建立component categories中的初始化安全和指令碼安全項

hresult createcomponentcategory(catid catid, wchar* catdescription);

//在clsid中建立與component categories中初始化安全和指令碼安全項中相對應的implemented categories項

hresult registerclsidincategory(refclsid clsid, catid catid);

//登出與clsid中的相應implemented categories項,一般用不到,因為其它程式可能也會用到這此項

hresult unregisterclsidincategory(refclsid clsid, catid catid);

extern const guid cdecl _tlid;

extern const guid cdecl clsid_safeitem;

extern const word _wvermajor;

extern const word _wverminor;

在對就的.cpp檔案中加入以下內容,如果原來程式中已經有的,只改動其中的多餘部分即可:

//設定控制項與登錄檔相關的型別庫id,後面跟有version(1.0)字樣,從本工程的.idl檔案中獲取

const guid cdecl based_code _tlid =

};//控制項在登錄檔中的clsid,後面跟有control字樣,從本工程的.idl檔案中獲取

const guid cdecl clsid_safeitem =

};const word _wvermajor = 1;

const word _wverminor = 0;

stdapi dllregisterserver(void)

// dllunregisterserver - removes entries from the system registry

stdapi dllunregisterserver(void)

hresult createcomponentcategory(catid catid, wchar* catdescription)

// key is registered.

categoryinfo catinfo;

catinfo.catid = catid;

catinfo.lcid = 0x0409 ; // english

// make sure the provided description is not too long.

// only copy the first 127 characters if it is.

int len = wcslen(catdescription);

if (len>127)

len = 127;

wcsncpy(catinfo.szdescription, catdescription, len);

// make sure the description is null terminated.

catinfo.szdescription[len] = '/0';

hr = pcr->registercategories(1, &catinfo);

pcr->release();

return hr;

}hresult registerclsidincategory(refclsid clsid, catid catid)

if (pcr != null)

pcr->release();

return hr;

}hresult unregisterclsidincategory(refclsid clsid, catid catid)

if (pcr != null)

pcr->release();

return hr;

}加入以上**後ie無任何警告,你可試一下,我用的沒問題

在Chrome上使用ActiveX控制項

一名id叫做eagleonhill的chrome迷論壇會員這幾天就寫出了乙個chrome擴充套件,通過將activex包裝成了chrome firefox支援的npapi外掛程式,從而實現在chrome firefox平台的activex控制項支援,目前已經基本實現了windows平台chrome的...

在Chrome上使用ActiveX控制項

ie 上使用 ocx 外掛程式網上已經有很多資料說明,這裡就不重複了,那如何在 chrome 瀏覽器上使用 ocx 外掛程式呢?1 編寫 ocx 外掛程式,增加測試 html 頁面。普通呼叫 本著讓世界變得更美好的高尚信念,我幫他們設計了一套解決方案,並幫他們開發了出來,執行多時,還算穩定。下面,就...

在ActiveX控制項中引入窗體技術

一 引入dialog技術 下面介紹在製作activex控制項時引入有模式對話方塊技術,製作步驟如下 建立一新的mfc activex controlwizard專案,取名為hello,其他用預設選項 在resourceview頁中新增一對話方塊資源,命名為idd hellodialog,可以在對話方...