mIRC Home    About    Download    Register    News    Help

Print Thread
#100795 16/10/04 08:00 PM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
I know in C++ "Internet_Explorer_Server" hwnd's can be created.

My question is, if I capture the HWND of one of these windows, how would I direct commands to it, like sending urls, etc.

#100796 16/10/04 08:05 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I guess you could get the hwnd of the url editbox using GetDlgItem(), then use SendMessage() to send the WM_KEYDOWN message with the url.

I'm new to api programming so you probably can't do that, but that's my guess.


New username: hixxy
#100797 16/10/04 08:17 PM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
it's not internet explorer. It's an hwnd with pretty much browser functionality. The class is "Internet_Explorer_Server"

#100798 18/10/04 12:01 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
i think it's a webbrowser control. Anyone know how to send navigation commands?

#100799 20/10/04 02:21 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
ok, I've learned that "Internet Explorer_Server" like that, is an IE instance.

It is controlable through the IE_server window, and the Shell DocObject View window with WM_COMMAND

There are several Command IDs, listed here: http://www.swissdelphicenter.ch/torry/showcode.php?id=2231
and here: http://www.codeguru.com/Cpp/I-N/internet/generalinternet/article.php/c8163/

However, none to navigate/open a website. Does anyone know how to get context menu IDs for the "File->Open" in Internet explorer, or know of a command ID to do so?

#100800 20/10/04 06:45 AM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
me again *waves*

heres some code to digest and figure out why its not navigating:

Code:
   HWND web = FindWindowEx(shelldoc,NULL,"Internet Explorer_Server",NULL);


	  HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") );

CComPtr<IHTMLDocument2> spDoc;
	LRESULT lRes;

		UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
				::SendMessageTimeout( web, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lRes );

				LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, _T("ObjectFromLresult") );
				if ( pfObjectFromLresult != NULL )
				{
					HRESULT hr;
					hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument, 0, (void**)&spDoc );
					if ( SUCCEEDED(hr) )
					{
						CComPtr<IDispatch> spDisp;
						CComQIPtr<IHTMLWindow2> spWin;
						spDoc->get_Script( &spDisp );
						spWin = spDisp;
						spWin->get_document( &spDoc.p );
						// Change background color to red
				//		spDoc->put_bgColor( CComVariant("red") );
						spWin->navigate((BSTR)"http://www.mirc.com");
					}
				}
::FreeLibrary( hInst );
	CoUninitialize(); 

#100801 23/10/04 08:39 PM
Joined: Mar 2003
Posts: 187
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
got all my problems fixed!


Link Copied to Clipboard