多TAB下让某个页面提前
来源:互联网 发布:淘宝店铺店招怎么制作 编辑:程序博客网 时间:2024/05/01 15:04
转帖
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=743273&SiteID=1
found solution. Spicific IE7 tab can be set as active via Active Accessability !
This is my very very first experemental but !!!WORKING!!! code !
I write it under BDS 2006, but it 's must work under Visual studio to.
I hope it 's helps:
void __fastcall TForm1::ActivateTab(TObject *Sender)
{
HRESULT hRes;
HWND MainIEWnd;
HWND CommandBarWnd;
HWND ReBarWnd;
HWND TabBandWnd;
HWND DirectUIWnd;
BSTR tabCaption;
long TabsCount=0,TabsReceived=0,newRes;
IAccessible *tabsAccess,*tabObject,*newObj;
IDispatch *tabDisp,*tab1;
VARIANT ChildStruct[10],tabStruct[10],tabQueryStruct,tabResStruct;
tabQueryStruct.vt=VT_I4;
tabQueryStruct.lVal=CHILDID_SELF;
/*
IE7 windows tree:
IEFrame
|
--CommandBarClass
|
--ReBarWindow32
|
--TabBandClass
|
--DirectUIHWND < < < < < IE 7 Tabs here !!!
*/
MainIEWnd=FindWindow( "IEFrame ",NULL);
if(!MainIEWnd)
{
ShowMessage( "DEBUG: Unable to find main IE window ");
return;
}
CommandBarWnd=FindWindowEx(MainIEWnd,NULL, "CommandBarClass ",NULL);
if(!CommandBarWnd)
{
ShowMessage( "DEBUG: Unable to find CommandBarWindow ");
return;
}
ReBarWnd=FindWindowEx(CommandBarWnd,NULL, "ReBarWindow32 ",NULL);
if(!ReBarWnd)
{
ShowMessage( "DEBUG: Unable to find ReBarWindow32 ");
return;
}
TabBandWnd=FindWindowEx(ReBarWnd,NULL, "TabBandClass ",NULL);
if(!TabBandWnd)
{
ShowMessage( "DEBUG: Unable to find TabBandClass ");
return;
}
DirectUIWnd=FindWindowEx(TabBandWnd,NULL, "DirectUIHWND ",NULL);
if(!DirectUIWnd)
{
ShowMessage( "DEBUG: Unable to find DirectUIHWND ");
return;
}
if(AccessibleObjectFromWindow(DirectUIWnd,OBJID_CLIENT,IID_IAccessible,(void **)&tabsAccess)!=S_OK)
{
ShowMessage( "DEBUG: Unable to get IAccessible interface ");
return;
}
hRes=tabsAccess-> get_accChildCount(&TabsCount); // get objects count
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: Unable to get Objects count ");
return;
}
hRes=AccessibleChildren(tabsAccess,0,TabsCount,ChildStruct,&TabsReceived);
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: Unable to get objects ");
return;
}
for(int i=0;i <TabsReceived;i++) // enum objects
{
if(ChildStruct.vt==VT_DISPATCH)
{
tabDisp=ChildStruct.pdispVal;
hRes=tabDisp-> QueryInterface(IID_IAccessible,(void **)&tabObject);
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: QueryInterface to tabObject failed ");
continue;
}
hRes=tabObject-> get_accRole(tabQueryStruct,&tabResStruct);
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: Unable to receive object role ");
continue;
}
if(tabResStruct.lVal!=ROLE_SYSTEM_PAGETABLIST) // we need only PageControl ! skip
continue; // another contorls
tabsAccess=tabObject; // we found PageControl with IE7 tabs !
hRes=tabsAccess-> get_accChildCount(&TabsCount); // number of opened tabs + New Tab button
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: tab count failed ");
continue;
}
hRes=AccessibleChildren(tabsAccess,0,TabsCount,tabStruct,&newRes);
for(int j=0;j <newRes;j++) // enum tabs
{
tab1=tabStruct[j].pdispVal;
hRes=tab1-> QueryInterface(IID_IAccessible,(void **)&newObj);
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: QueryInterface to newObj failed ");
continue;
}
hRes=newObj-> get_accName(tabQueryStruct,&tabCaption);
if(!SUCCEEDED(hRes))
{
ShowMessage( "DEBUG: Unable to receive tab caption ");
continue;
}
if(tabCaption==L "your specific string ")
// make this f..g tab active !!!!
newObj-> accDoDefaultAction(tabQueryStruct);
}
}
}
}
- 多TAB下让某个页面提前
- 按下enter键让提交页面的某个方法
- 多会话 tab页面 控制
- html 多页面切换tab
- iOS 如何让某个页面单独横屏
- Tab页面
- 一个页面显示多组Tab菜单
- 让Linux某个路径下的命令随处可以访问
- DELPHI下让HGE初始化在某个窗口内范例!
- 对类似Tab页面下的Listview滑动时,隐藏Tab导航
- 让easyUI TAB页随页面内的按钮事件变化
- Y2038,让我提前遇上了千年虫!
- 如何唤醒sleep,让sleep提前返回
- 爱就投:让商业文明提前进入共产主义
- 如何让DIV固定在页面的某个位置而不随着滚动条随意滚动
- 让DIV块在页面的某个位置固定的css代码
- 如何让DIV固定在页面的某个位置而不随着滚动条随意滚动
- 如何让DIV固定在页面的某个位置而不随着滚动条随意滚动
- (PS)かまいたちの夜•特別篇 汉化笔记 十三
- 用ultraedit实现代码格式自动排列(自动缩进)
- 模拟表单点击
- oracle数据库同步技术
- 解决SVN服务器更改ip地址后,本地svn重新连接问题
- 多TAB下让某个页面提前
- 利用压缩提高DevExpress ASP.NET 性能
- 什么是iPython
- 【批处理+VBS】实现开机启动程序,实时监控,程序关闭,关闭系统
- WebLogic和Tomcat的区别
- Oracle内存结构总表
- CListCtrl::InsertColumn出错Debug Assertion Failed
- 贴片保险丝如何选型?
- 关于C++解析utf-8字符流的转换