用VC++对IE浏览器进行高级操作
来源:互联网 发布:linux怎么进入命令模式 编辑:程序博客网 时间:2024/04/29 16:03
————————————————以下为程序代码—————————————
------------WriteReg()函数的主要内容:-----------
void CTestView::WriteReg()
{
//建立上下文菜单
HKEY phkResult;
LPCTSTR lpSubKey = "Software//Microsoft//Internet Explorer//MenuExt";
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, lpSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &phkResult, 0))
{
CString keyValue = GetAppPath() + "MySelf.htm";
RegSetValue(phkResult, "我们自己的上下文菜单(&W)", REG_SZ, keyValue, keyValue.GetLength());
}
//建立工具菜单
lpSubKey = "Software//Microsoft//Internet Explorer//Extensions//{32204547-1C47-11d5-A413-00A00CC191CF}";
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,&phkResult,0))
{
HKEY hResult;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_ALL_ACCESS, &hResult);
CString type = "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}";
RegSetValueEx(hResult, "CLSID", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="&MyTest"; //MenuText
RegSetValueEx( hResult, "MenuText", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="我们自己的测试程序"; //MenuStatusBar
RegSetValueEx( hResult, "MenuStatusBar", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength()); 0
type=GetAppPath()+"Test.exe"; //Exec
RegSetValueEx( hResult, "Exec", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
//工具栏按钮
type="MyTest"; //ButtonText
RegSetValueEx( hResult, "ButtonText", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type=GetAppPath()+"//Test.exe,128"; //Icon
RegSetValueEx( hResult, "Icon", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type=GetAppPath()+"//Test.exe,128"; //HotIcon
RegSetValueEx( hResult, "HotIcon", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="Yes"; //Default Visible
RegSetValueEx( hResult, "Default Visible", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
RegCloseKey( hResult );
}
}
------------GetAppPath()-----------------
CString CTestView::GetAppPath()
{
TCHAR pathtemp[255];
GetModuleFileName(NULL,pathtemp,255);
CString path = pathtemp;
int i = path.ReverseFind('//');
path = path.Left(i+1);
return path;
}
----------------MySelf.htm---------------
<HTML>
<SCRIPT LANGUAGE="JavaScript">
var op = new String("http://www.tsinghua.edu.cn/")
open(op)
</SCRIPT>
</HTML>
----------------text.exe----------------
void CIEcontext::AddContext()
{
// TODO: Add your dispatch handler code here
WinExec("c://test//debug//test.exe", SW_SHOW);
}
--------------修改后的MySelf.htm------------
<HTML>
<SCRIPT language="VBScript">
set IeP=CreateObject("AddIEFun.IEcontext")
if err<>0 then
msgbox("错误!")
else
IeP. AddContext()
end if
</SCRIPT>
</HTML>
------------WriteReg()函数的主要内容:-----------
void CTestView::WriteReg()
{
//建立上下文菜单
HKEY phkResult;
LPCTSTR lpSubKey = "Software//Microsoft//Internet Explorer//MenuExt";
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, lpSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &phkResult, 0))
{
CString keyValue = GetAppPath() + "MySelf.htm";
RegSetValue(phkResult, "我们自己的上下文菜单(&W)", REG_SZ, keyValue, keyValue.GetLength());
}
//建立工具菜单
lpSubKey = "Software//Microsoft//Internet Explorer//Extensions//{32204547-1C47-11d5-A413-00A00CC191CF}";
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,&phkResult,0))
{
HKEY hResult;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_ALL_ACCESS, &hResult);
CString type = "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}";
RegSetValueEx(hResult, "CLSID", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="&MyTest"; //MenuText
RegSetValueEx( hResult, "MenuText", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="我们自己的测试程序"; //MenuStatusBar
RegSetValueEx( hResult, "MenuStatusBar", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength()); 0
type=GetAppPath()+"Test.exe"; //Exec
RegSetValueEx( hResult, "Exec", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
//工具栏按钮
type="MyTest"; //ButtonText
RegSetValueEx( hResult, "ButtonText", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type=GetAppPath()+"//Test.exe,128"; //Icon
RegSetValueEx( hResult, "Icon", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type=GetAppPath()+"//Test.exe,128"; //HotIcon
RegSetValueEx( hResult, "HotIcon", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
type="Yes"; //Default Visible
RegSetValueEx( hResult, "Default Visible", 0, REG_SZ, (const unsigned char *)((LPCSTR)type), type.GetLength());
RegCloseKey( hResult );
}
}
------------GetAppPath()-----------------
CString CTestView::GetAppPath()
{
TCHAR pathtemp[255];
GetModuleFileName(NULL,pathtemp,255);
CString path = pathtemp;
int i = path.ReverseFind('//');
path = path.Left(i+1);
return path;
}
----------------MySelf.htm---------------
<HTML>
<SCRIPT LANGUAGE="JavaScript">
var op = new String("http://www.tsinghua.edu.cn/")
open(op)
</SCRIPT>
</HTML>
----------------text.exe----------------
void CIEcontext::AddContext()
{
// TODO: Add your dispatch handler code here
WinExec("c://test//debug//test.exe", SW_SHOW);
}
--------------修改后的MySelf.htm------------
<HTML>
<SCRIPT language="VBScript">
set IeP=CreateObject("AddIEFun.IEcontext")
if err<>0 then
msgbox("错误!")
else
IeP. AddContext()
end if
</SCRIPT>
</HTML>
- 用VC++对IE浏览器进行高级操作
- IE浏览器利用ActiveXObject对象对文件系统进行操作
- VC对Office进行操作
- vc用com操作ie
- metasploit对IE浏览器的极光漏洞进行渗透利用
- Metasploit 对 IE 浏览器的极光漏洞进行渗透利用
- VC改造IE浏览器
- 利用VC对Excel进行操作
- VC++对成批控件进行操作
- VC对csv文件进行读写操作
- 用matlab进行ie操作
- 用JS操作CSS滤镜,注意IE、firefox、chrome浏览器对滤镜支持各不相同
- js对系统、IE浏览器的相关操作
- vb操作ie浏览器
- vba操作IE浏览器
- C#操作IE浏览器
- Python高级编程-如何对迭代器进行切片操作?
- VC中自定义IE浏览器
- MANAGED SPY:用我们的新工具继续Spy 对Windows Forms的神话
- Collection与Map小记
- GridView 72般绝技(一)
- 如果一个男人为你流泪!请珍惜(转)
- C# API 大全
- 用VC++对IE浏览器进行高级操作
- 跟着学习走
- posix 与 ansi c
- j2me手机游戏开发之俄罗斯方块--附完整源代码
- java中几种常用的排序算法
- 如何学java《转》
- CPaintDC和CClientDC的区别
- C#存储过程调用通用类
- 在VC6下使用Boost库的步骤