Link to home
Start Free TrialLog in
Avatar of sachelis
sachelis

asked on

Simulate a click from a IWebBrowser2 control

I have a IWebBrowser2 control in MFC (so it's a CWebbrowser_ctrl). I've loaded a page into the control that contains a link that executes javascript:

<a href="javascript:;" class="classname" id="E">Link Text</a>

How can I programmically (from withing MFC) simulate a click on the Link Text?

Thanks!
SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe is useful to know that using a CDHtmlDialog, before to make Javascript call, you should Navigate to you local or remote Web Page.
BOOL CDlgGoogleMaps::OnInitDialog()
{
	CDHtmlDialog::OnInitDialog();

	CString snavigate = GetMapsDir();

	if(!snavigate.IsEmpty()) { // your html web page
		Navigate(snavigate, NULL, NULL, NULL, NULL);
		bInit = TRUE;
		return TRUE;
	}

	return FALSE;
}

Open in new window