Click here to Skip to main content
15,171,576 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm looking to find some code or samples of projects or tutorials on creating a WebBrowser Control in MFC that would allow me to embed Google maps set markers and then use those markers as hyperlinks, any Help would be great, if anyone knows of a program that is already like this please comment thank you :)
Posted
Updated 19-Sep-11 5:18am
v2

1 solution

You can for example:
1) create a dialog based project.
2) allow ocx controls.
3) open the dialog resource.
4) right click and select insert ocx-object.
5) select Microsoft Web Browser.
6) right click on the ocx and select add a new member.
7) only type at member name (i.e.) m_web.

C++
BOOL CGMapsDlg::OnInitDialog()
{
  CDialog::OnInitDialog();

  SetIcon(m_hIcon, TRUE);
  SetIcon(m_hIcon, FALSE);
  
  m_web.Navigate2(&_variant_t(L"http://maps.google.com/"),0,0,0,0);

  IDispatch*  doc = m_web.get_Document();
  if(doc)
  {
    // from here you have full access to the complete document structure
    doc->Release();
  }
  return TRUE;
}

for usage of _variant_t you need:
C++
#include <comutil.h>
#pragma comment (lib,"comsuppw.lib")

Regards.
   

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