1

I am trying to retrieve my windows laptop geo location from a C++ application. The below link contain a beautiful example written in C++, but this only works if GPS sensor is present in laptop, and this COM API got deprecated and windows may stop the service itself anytime sooner.

https://www.winwaed.com/blog/2018/12/07/using-the-windows-7-location-api/

As per the windows, the most recent recommended way of getting GeoLocaiton is documented in below URL, but this needs a C# application to use the System.Device.Location namespace, whereas I need a C++ solution.

https://learn.microsoft.com/en-us/windows/desktop/locationapi/windows-location-api-portal

System.Device.Location namespace uses wifi Access point as well to retrieve the location, therefore GPS chip dependency is no longer present.

Could anyone recommend on how can I use this System.Device.Location namespace in C++ application?

~Ashish

Ashish Mittal
  • 643
  • 3
  • 12
  • 32
  • 1
    Create a wrapper in C++/CLI? – Some programmer dude Jan 30 '19 at 09:00
  • hello i have the same problem and i'm wondering if you found a way – SDIDSA Apr 18 '19 at 07:54
  • Hi!! I am able to use the same link as shared above to get the geo location using C++ and WIN32 COM libraries. It will not work for Win10 OS for sure, but I am able to get the location in Win8.1 OS. WIN8.1 OS has a driver inbuild called Windows Location Driver, which provides the geo location to the C++ client even if the GPS chip not present on the machine. It uses the ip address, wifi signal to get the geo location. https://www.winwaed.com/blog/2018/12/07/using-the-windows-7-location-api/ – Ashish Mittal Apr 19 '19 at 10:37

1 Answers1

0

You may want to try this:

Use C++ ATL COM to obtain real-time GPS coordinates on the Windows platform, support location monitoring, and implement the same method as dotNet's System.Device.Location

https://github.com/spianmo/GeoLocation

Jeremy
  • 107
  • 1
  • 5