Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am going to develop the project that should control in any browser (IE/FireFox/Chrom).
In IE I got the IWebBrowser objects using shell.
C++
CComPtr<IShellWindows> pShellWindows;
		pShellWindows.CoCreateInstance(CLSID_ShellWindows);

		if(pShellWindows)
		{
			long lShellWindowCount=0;
			pShellWindows->get_Count(&lShellWindowCount);
			for(long i = 0; i < lShellWindowCount; i++)
			{
				CComPtr<IDispatch> pdispShellWindow;

				pShellWindows->Item(CComVariant(i),&pdispShellWindow);

				CComQIPtr<IWebBrowser2> pIE(pdispShellWindow);
				if(pIE)//is it a Shell window?
				{
					HWND hforeground = GetForegroundWindow();

					//is it the right type?
					LONG_PTR lwnd=NULL;
					pIE->get_HWND(&lwnd);
					HWND hwnd=reinterpret_cast<HWND>(lwnd);
					char className[_MAX_PATH];ZeroMemory(className, sizeof(className));
					//HWND hwnd = GetTabWindow(pIE);

					::GetClassName(hwnd, className ,_MAX_PATH);

					if(hforeground == hwnd && strcmp("IEFrame", className) == 0)
					{
						Here:
					}
				}	
			}
		}

But Here: the window handle of All tabs are same foreground window handle.
How do i get the active tab?
and How do i get the urls in Other Browser(Chrome/FireFox).
Thank you.

Help me.
Posted
Updated 7-Dec-15 22:28pm
v2
Comments
Richard MacCutchan 8-Dec-15 4:30am    
Since all browsers are written in different ways there is no answer for this question. you would need to use something like Spy++ to see the messages that they use, and how each one operates.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900