Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. GET PC POSITION IN VISUAL BASIC

GET PC POSITION IN VISUAL BASIC

Scheduled Pinned Locked Moved Visual Basic
javascriptquestion
12 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Otekpo Emmanuel
    wrote on last edited by
    #1

    GOOD DAY FRIENDS! Please, is it possible to detect when the pc or laptop position changes using visual basic? Take for instance, if pc was initially located at position A and later moved to position B; then, the application should be able to get the position's changes. In a simplified term, assuming pc was in Lat. 30 and Log. 40, if position changes, then the lat. and log. values should also change. Finally found what I want but it is in javascript. Can anyone convert this to a desktop application in vb.

    window.onload = function () {
            var mapOptions = {
                center: new google.maps.LatLng(18.9300, 72.8200),
                zoom: 14,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var infoWindow = new google.maps.InfoWindow();
            var latlngbounds = new google.maps.LatLngBounds();
            var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
            google.maps.event.addListener(map, 'click', function (e) {
                alert("Latitude: " + e.latLng.lat() + "\\r\\nLongitude: " + e.latLng.lng());
            });
        }
    

    Thanks in advance!

    C A 2 Replies Last reply
    0
    • O Otekpo Emmanuel

      GOOD DAY FRIENDS! Please, is it possible to detect when the pc or laptop position changes using visual basic? Take for instance, if pc was initially located at position A and later moved to position B; then, the application should be able to get the position's changes. In a simplified term, assuming pc was in Lat. 30 and Log. 40, if position changes, then the lat. and log. values should also change. Finally found what I want but it is in javascript. Can anyone convert this to a desktop application in vb.

      window.onload = function () {
              var mapOptions = {
                  center: new google.maps.LatLng(18.9300, 72.8200),
                  zoom: 14,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              var infoWindow = new google.maps.InfoWindow();
              var latlngbounds = new google.maps.LatLngBounds();
              var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
              google.maps.event.addListener(map, 'click', function (e) {
                  alert("Latitude: " + e.latLng.lat() + "\\r\\nLongitude: " + e.latLng.lng());
              });
          }
      

      Thanks in advance!

      C Offline
      C Offline
      Chris Quinn
      wrote on last edited by
      #2

      If the machine has inbuilt GPS hardware then yes, probably. If not, you may be able to get a rough location from wifi connection data. Accuracy will be poor though.

      ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

      O 1 Reply Last reply
      0
      • O Otekpo Emmanuel

        GOOD DAY FRIENDS! Please, is it possible to detect when the pc or laptop position changes using visual basic? Take for instance, if pc was initially located at position A and later moved to position B; then, the application should be able to get the position's changes. In a simplified term, assuming pc was in Lat. 30 and Log. 40, if position changes, then the lat. and log. values should also change. Finally found what I want but it is in javascript. Can anyone convert this to a desktop application in vb.

        window.onload = function () {
                var mapOptions = {
                    center: new google.maps.LatLng(18.9300, 72.8200),
                    zoom: 14,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                var infoWindow = new google.maps.InfoWindow();
                var latlngbounds = new google.maps.LatLngBounds();
                var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
                google.maps.event.addListener(map, 'click', function (e) {
                    alert("Latitude: " + e.latLng.lat() + "\\r\\nLongitude: " + e.latLng.lng());
                });
            }
        

        Thanks in advance!

        A Offline
        A Offline
        Afzaal Ahmad Zeeshan
        wrote on last edited by
        #3

        There are many ways that you can do this, first and foremost has been shared with you through the use of GPS hardware. That will detect the location, and you can then write the program to get the location and show it or process it. However, if you need to get the location of a machine inside the office or a building, you can also possibly use the network interfaces, to determine where the machine is at the moment. Note that, this is very bad in cases where you need to pinpoint location, but changes can be detected easily based on the network or the endpoint from where the machine is communication. And as for Visual Basic, which one? The VB 6? I am unsure, whether you will be able find any solution for that, C++ or C# or Java might do some help in these cases. Even Vb.NET would require some help from C# world. Have a look here, [monitoring - Is it possible to find a computer's physical location in a room? - Server Fault](https://serverfault.com/questions/671781/is-it-possible-to-find-a-computers-physical-location-in-a-room)

        The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

        O 1 Reply Last reply
        0
        • C Chris Quinn

          If the machine has inbuilt GPS hardware then yes, probably. If not, you may be able to get a rough location from wifi connection data. Accuracy will be poor though.

          ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

          O Offline
          O Offline
          Otekpo Emmanuel
          wrote on last edited by
          #4

          Thanks for your response. How can I achieve this your suggestion please?

          C 1 Reply Last reply
          0
          • O Otekpo Emmanuel

            Thanks for your response. How can I achieve this your suggestion please?

            C Offline
            C Offline
            Chris Quinn
            wrote on last edited by
            #5

            Investigate the Google Maps API

            ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

            O 1 Reply Last reply
            0
            • C Chris Quinn

              Investigate the Google Maps API

              ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

              O Offline
              O Offline
              Otekpo Emmanuel
              wrote on last edited by
              #6

              Thank you so much for your time of response. Please, I tried reading about google's map api but not getting the flow. It only shows the country as a whole. But what am looking for is, assuming a pc position was lat 30.001 and log. 40.687 and was later shifted from initial position to another. I want the software to update it self with the pc current position. Please help. Once again, thanks.

              L 1 Reply Last reply
              0
              • O Otekpo Emmanuel

                Thank you so much for your time of response. Please, I tried reading about google's map api but not getting the flow. It only shows the country as a whole. But what am looking for is, assuming a pc position was lat 30.001 and log. 40.687 and was later shifted from initial position to another. I want the software to update it self with the pc current position. Please help. Once again, thanks.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                And how is that software supposed to know when the PC has been moved, or to figure out exactly where it is on the surface of the earth? As has already been mentioned, unless the PC contains a GPS receiver then you cannot do it.

                O 1 Reply Last reply
                0
                • L Lost User

                  And how is that software supposed to know when the PC has been moved, or to figure out exactly where it is on the surface of the earth? As has already been mentioned, unless the PC contains a GPS receiver then you cannot do it.

                  O Offline
                  O Offline
                  Otekpo Emmanuel
                  wrote on last edited by
                  #8

                  The script posted by me connects to Google Map API and retrieves someone current lat. and log. but it is written in JavaScript.Looking for a way to convert it to VB (VB 6.0 or VB.Net). Any help please.

                  D L 2 Replies Last reply
                  0
                  • O Otekpo Emmanuel

                    The script posted by me connects to Google Map API and retrieves someone current lat. and log. but it is written in JavaScript.Looking for a way to convert it to VB (VB 6.0 or VB.Net). Any help please.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    OK, but Google Maps API does't magically know with any REAL accuracy where the machine is UNLESS IT HAS A GPS RECEIVER. Without that YOU have to tell Google where the machine is. If you rely on any other detection machanism, like Geomapping an IP, it can be off by dozens of miles. Right now, if I don't tell Google explicitly, it'll guess that my machine is 36 miles from where it really is.

                    System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

                    Click this: Asking questions is a skill. Seriously, do it.
                    Dave Kreskowiak

                    O 1 Reply Last reply
                    0
                    • O Otekpo Emmanuel

                      The script posted by me connects to Google Map API and retrieves someone current lat. and log. but it is written in JavaScript.Looking for a way to convert it to VB (VB 6.0 or VB.Net). Any help please.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      How many times do we need to explain: if you do not have a GPS receiver in the PC no software can find its location. Google maps will only tell you the location of the IP address of your broadband provider. In my case that is some 70 miles from where I live.

                      1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        OK, but Google Maps API does't magically know with any REAL accuracy where the machine is UNLESS IT HAS A GPS RECEIVER. Without that YOU have to tell Google where the machine is. If you rely on any other detection machanism, like Geomapping an IP, it can be off by dozens of miles. Right now, if I don't tell Google explicitly, it'll guess that my machine is 36 miles from where it really is.

                        System.ItDidntWorkException: Something didn't work as expected. A guide to posting questions on CodeProject

                        Click this: Asking questions is a skill. Seriously, do it.
                        Dave Kreskowiak

                        O Offline
                        O Offline
                        Otekpo Emmanuel
                        wrote on last edited by
                        #11

                        Thanks for your vital information!

                        1 Reply Last reply
                        0
                        • A Afzaal Ahmad Zeeshan

                          There are many ways that you can do this, first and foremost has been shared with you through the use of GPS hardware. That will detect the location, and you can then write the program to get the location and show it or process it. However, if you need to get the location of a machine inside the office or a building, you can also possibly use the network interfaces, to determine where the machine is at the moment. Note that, this is very bad in cases where you need to pinpoint location, but changes can be detected easily based on the network or the endpoint from where the machine is communication. And as for Visual Basic, which one? The VB 6? I am unsure, whether you will be able find any solution for that, C++ or C# or Java might do some help in these cases. Even Vb.NET would require some help from C# world. Have a look here, [monitoring - Is it possible to find a computer's physical location in a room? - Server Fault](https://serverfault.com/questions/671781/is-it-possible-to-find-a-computers-physical-location-in-a-room)

                          The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                          O Offline
                          O Offline
                          Otekpo Emmanuel
                          wrote on last edited by
                          #12

                          Thanks for your vital information!

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups