none
How use Bing Maps in a VC++ 2010 non-.Net desktop app? RRS feed

  • Question

  • Hi - I have a Visual C++ 2010 app.  It's not .Net app and it's not a Windows Store App and I have no plans to turn it into either.  It runs on Windows XP, Vista, 7 and 8, on the desktop.  I would like to add mapping support within a window.  Can I use the Bing Maps AJAX Control to do this?  If so, can anyone point me to the documentation for this and preferably examples I could work from?  Can I use Bing Maps REST services?  If not these, can I use Bing Maps at all?  If not, what should I use?

    All help very much appreciated.

    Simon


    Simon

    Friday, April 19, 2013 9:42 AM

Answers

  • You can definitely use the Bing Maps REST services as they can be used with any programming language capable of connecting to the internet. You could use the AJAX control by embedding it inside of a webbrowser control. I'm not aware of any examples using c++ but there are some that use c# that you can use as a reference of how to do this. Note all the samples you will find will be old and will say "Virtual Earth" instead of Bing Maps as that's the old name for Bing Maps. Here is one such control:

    https://bingmapscontrol.codeplex.com/

    This is how we used to integrate Bing Maps into desktop apps before we had the WPF control. That said you may find it possible to integrate the WPF control with c++. Take a look at these two posts:

    http://www.codeproject.com/Articles/42965/How-to-Integrate-C-Window-in-C-Project

    http://rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/


    http://rbrundritt.wordpress.com

    Friday, April 19, 2013 12:19 PM
  • Personally I think the WPF approach would be your best option. I'm not too surprised that project doesn't work. As I mentioned this is a very old technique that is usually avoided as it is error prone and a lot of work. Basically you need to create an interlop that communicates between your c++ code and the JavaScript of an application in the WebBrowser control by injecting JavaScript commands.

    http://rbrundritt.wordpress.com

    Friday, April 19, 2013 6:21 PM

All replies

  • You can definitely use the Bing Maps REST services as they can be used with any programming language capable of connecting to the internet. You could use the AJAX control by embedding it inside of a webbrowser control. I'm not aware of any examples using c++ but there are some that use c# that you can use as a reference of how to do this. Note all the samples you will find will be old and will say "Virtual Earth" instead of Bing Maps as that's the old name for Bing Maps. Here is one such control:

    https://bingmapscontrol.codeplex.com/

    This is how we used to integrate Bing Maps into desktop apps before we had the WPF control. That said you may find it possible to integrate the WPF control with c++. Take a look at these two posts:

    http://www.codeproject.com/Articles/42965/How-to-Integrate-C-Window-in-C-Project

    http://rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/


    http://rbrundritt.wordpress.com

    Friday, April 19, 2013 12:19 PM
  • Hi - thanks for the reply.  I couldn't get the codeplex example to build.  Not sure what the problem was.  Also, the links on how to use it didn't work.  I'm a bit sceptical about trying to get the WPF control to work in a C++ app.  It looks like it could be quite a performance.  I presume when you talk about using the AJAX control embeded inside a webbrowser control, that means hand-crafting an appropriate web page, with embedded Java, and supplying that to a webbrowser control?


    Simon

    Friday, April 19, 2013 5:42 PM
  • Personally I think the WPF approach would be your best option. I'm not too surprised that project doesn't work. As I mentioned this is a very old technique that is usually avoided as it is error prone and a lot of work. Basically you need to create an interlop that communicates between your c++ code and the JavaScript of an application in the WebBrowser control by injecting JavaScript commands.

    http://rbrundritt.wordpress.com

    Friday, April 19, 2013 6:21 PM