VB6 WebBrowser problem... a serious problem!-VBForums
Results 1 to 19 of 19

Thread: VB6 WebBrowser problem... a serious problem!

  1. #1

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Question VB6 WebBrowser problem... a serious problem!

    Hi forum,
    I've a VB6 project within a WebBrowser control on the main form.
    I use it for visualize a map of the city with GoogleMaps.
    Recently it gives me this error: "This browser is not more supported".
    I'm using Internet Explorer 8 on a XP operative system... the latest browser for Windows XP.
    Support for Windows XP and Internet Explorer 8 on Windows XP has ended.

    How can I resolve my problem?
    I need a space on my form where I can visualize a GoogleMaps map.
    Thanks.

    Andrea

  2. #2
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: VB6 WebBrowser problem... a serious problem!

    It think its because the webbrowser control does not get updated in the registry when upgrading IE so please follow this link either mine or Schmidt (which is a class and a lot easier to use) solution should work. Let me know if it works!
    http://www.vbforums.com/showthread.p...ght=Webbrowser

    Edit: sorry forgot to add link
    Last edited by Max187Boucher; May 3rd, 2015 at 07:02 PM.

  3. #3
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: VB6 WebBrowser problem... a serious problem!

    Dont have time to look into it but i think they have a google map API not sure if its free or not. But if my first suggestion does not work then you could have a look at the api.
    I thought there was an example lately in the forums maybe search for google api.

    Edit:
    You could always use Internet explorer window (either reference it or CreateObject) and use SetParent API to set it into your form. There is a SetParent api example in the link i provided if interested.
    Last edited by Max187Boucher; May 3rd, 2015 at 07:20 PM.

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,217

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Max187Boucher View Post
    Dont have time to look into it but i think they have a google map API not sure if its free or not.
    Sure, the API is there and it's free.

    Please take a look at this thread here (post #4):
    http://www.vbforums.com/showthread.p...=1#post4641473

    There I've offered a Demo-Zip, which is only based on a normal (Std-Project-Private) VB6-Usercontrol,
    and nothing else (no IE-Control, no API).

    @Saturnus83
    Here's what it looks like - and what it supports:


    Olaf

  5. #5
    Hyperactive Member
    Join Date
    May 2011
    Posts
    370

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by saturnus83 View Post
    Hi forum,
    I've a VB6 project within a WebBrowser control on the main form.
    I use it for visualize a map of the city with GoogleMaps.
    Recently it gives me this error: "This browser is not more supported".
    I'm using Internet Explorer 8 on a XP operative system... the latest browser for Windows XP.
    Support for Windows XP and Internet Explorer 8 on Windows XP has ended.

    How can I resolve my problem?
    I need a space on my form where I can visualize a GoogleMaps map.
    Thanks.

    Andrea
    Do you register you app under FEATURE_BROWSER_EMULATION registry key? I not, you are actually using IE7 engine in the WebBrowser control.

    Try searching this forum for further explanations.

    cheers,
    </wqw>

  6. #6

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Schmidt View Post
    Sure, the API is there and it's free.

    Please take a look at this thread here (post #4):
    http://www.vbforums.com/showthread.p...=1#post4641473

    There I've offered a Demo-Zip, which is only based on a normal (Std-Project-Private) VB6-Usercontrol,
    and nothing else (no IE-Control, no API).

    @Saturnus83
    Here's what it looks like - and what it supports:


    Olaf
    Thanks... very nice program! I'll study it!

  7. #7

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by wqweto View Post
    Do you register you app under FEATURE_BROWSER_EMULATION registry key? I not, you are actually using IE7 engine in the WebBrowser control.

    Try searching this forum for further explanations.

    cheers,
    </wqw>
    Where I can update my register parameters? What I have to do?
    Could you help me?
    Thanks

  8. #8
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: VB6 WebBrowser problem... a serious problem!

    Olaf's project will be a lot better to use i guarantee.
    If you want the registry key i gave you the link in Post #3 which i point out the registry key and Olaf gave a nice sample in that thread too check it out.

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,072

    Re: VB6 WebBrowser problem... a serious problem!

    It's a very nice map app. Any way to make the map move as you move the mouse (like scrolling)
    Last edited by jmsrickland; May 4th, 2015 at 12:16 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Max187Boucher View Post
    Olaf's project will be a lot better to use i guarantee.
    If you want the registry key i gave you the link in Post #3 which i point out the registry key and Olaf gave a nice sample in that thread too check it out.
    I tried to do that.
    I added (using the name of my app and the decimal number parameter 9000) a new entry here:
    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

    I restarted my pc also... but nothing is changed.

  11. #11
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: VB6 WebBrowser problem... a serious problem!

    There is another key under Local_machine i think, have you tried changing useragent? I think it would be ideal to use Olaf's example the api will be 80% faster (if not more) with no errors or webbrowser limitation. The api is probably pretty easy to use and sinc Olaf provided an example you should be able to do exactly what you are doing with a webbrowser or IE and probably even more.

    If we could see the project we could help fix it or at least the function you use to display the maps.
    Even if we did fix it believe me the api will save you a lot of debugging and errors.

  12. #12
    Hyperactive Member
    Join Date
    May 2011
    Posts
    370

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by saturnus83 View Post
    I tried to do that.
    I added (using the name of my app and the decimal number parameter 9000) a new entry here:
    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]

    I restarted my pc also... but nothing is changed.
    Is this happening w/ IE8 on an XP trying to emulate IE9?

    Hope you can figure out what decimal you need for yourapp.exe value.

    cheers,
    </wqw>

  13. #13
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,217

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by jmsrickland View Post
    It's a very nice map app. Any way to make the map move as you move the mouse (like scrolling)
    Did you try "normal Dragging" (holding the left mousekey down and then moving the map)?

    Thought that this should work ... not with "live-updates of the view" currently (whilst dragging), but in the
    MouseUp-Event the UserControl should navigate to the new coordinates (matching the Mouse-Distance).

    It wouldn't be *that* difficult to implement a Live-View whilst dragging - but for that the approach
    would need to be changed to a "tiled-one" (where one pre-downloads surrounding tiles, so that
    the visualization of coord-changes can be smoother, blitted from already cached Tiles).

    Olaf

  14. #14

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Schmidt View Post
    Did you try "normal Dragging" (holding the left mousekey down and then moving the map)?

    Thought that this should work ... not with "live-updates of the view" currently (whilst dragging), but in the
    MouseUp-Event the UserControl should navigate to the new coordinates (matching the Mouse-Distance).

    It wouldn't be *that* difficult to implement a Live-View whilst dragging - but for that the approach
    would need to be changed to a "tiled-one" (where one pre-downloads surrounding tiles, so that
    the visualization of coord-changes can be smoother, blitted from already cached Tiles).

    Olaf
    Perfetct.
    I nedd also to create route from one place to another. Can I do that with your app?

  15. #15
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,072

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Schmidt View Post
    Did you try "normal Dragging" (holding the left mousekey down and then moving the map)?
    Sure I did that but that only moves the map at end of 'drag' with mouseup


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  16. #16
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,217

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by saturnus83 View Post
    Perfetct.
    I nedd also to create route from one place to another. Can I do that with your app?
    I assume you're already aware, that for any additional stuff you want to draw "On-Top" of the current Map,
    (as e.g. your own Markers or PolyLines) it is recommended to base those Drawings on Lat/Lng-Coords, to work properly.

    E.g. when you have a "GPS-based Travel-Companion" like a "Garmin-Device" (or an appropriate
    Application in your SmartPhone for that kind of stuff), and you import the GPS-Coords
    from your last "Bicycle-ride" from it - then you will already have the right "Base-Format".

    The Points I currently store in the "MapPoints-ListBox" of the small Demo, also already fulfill
    that criterion - so (for convenience sake), I will use those Lat/Lng-Points in that ListBox for
    my example below (to draw a PolyLine from the Coords in that List).

    You will have to enhance the UserControl (a little bit) first, so that you'll be able to put your own
    Drawings on Top of the current, "just refreshed Map-BackGround-Image".

    Since you want to handle this stuff outside the Control (in your App) - it would be good to
    introduce an appropriate Event into the UserControl, which is ideally raised at a Point,
    where the BackGround-Image was just drawn onto the UserControl-Canvas.

    And this point is here (the new Line of code marked magenta)
    Code:
    Private Sub UserControl_Paint()
      SetStretchBltMode hDC, 4
      StretchBlt hDC, 0, 0, ScaleWidth, ScaleHeight, BackBuf.hDC, 0, 0, BackBuf.Width, BackBuf.Height, vbSrcCopy
      RaiseEvent PaintOnTopOfCanvas(hDC)
    End Sub
    Of course raising an Event from the UserControl needs the accompanying Event-Definition in the Declaration-Section of the Control:
    (the new Line of code again marked magenta)
    Code:
    Event MouseMove(ByVal GMouseCoordLatLng As String)
    Event MouseUp(ByVal GMouseCoordLatLng As String)
    Event DblClick(ByVal GMouseCoordLatLng As String)
    Event PaintOnTopOfCanvas(ByVal hDC As Long)
    Other Additions which would be useful to place in the UserControl itself are a few (Public) Helper-Routines,
    to ease the Lat/Lng-Coord-Conversion to Canvas-Pixels, as well as some Drawing-Settings:
    (New code, e.g. place it at the end of the UserControl if you want):
    Code:
    Public Function LngToCanvasPxlX(Lng) As Long 'Longitude to current CanvasPixel-X (respecting the current Scaled-Size)
      LngToCanvasPxlX = ((LngToPxlX(Lng) - LngToPxlX) / mSize + 0.5) * ScaleWidth
    End Function
    Public Function LatToCanvasPxlY(Lat) As Long 'Latitude to current CanvasPixel-Y (respecting the current Scaled-Size)
      LatToCanvasPxlY = ((LatToPxlY(Lat) - LatToPxlY) / mSize + 0.5) * ScaleHeight
    End Function
    
    Public Sub SetLineWidthAndColor(LineWidth, Color) 'just some Settings for LineWidth and Color before GDI-calls are made outside
      UserControl.ForeColor = Color
      UserControl.DrawWidth = LineWidth
    End Sub
    That's it already with regards to changes and enhancements on the UserControl-Code,
    the rest should be handled outside (in your App) - and it's up to you what you draw on Top of the current Map.

    The following is just an example which simply connects the currently defined Marker-Positions in the Forms ListBox -
    (...which doesn't make much sense probably - but it shows how to deal with "Lat,Lng-Coord-Lists", defined outside the Control)

    Code:
    Private Sub ucGMap1_PaintOnTopOfCanvas(ByVal hDC As Long)
    Dim i As Long, strLatLng, Lat, Lng, PolyPoints() As Long
      
      If lstMarkers.ListCount = 0 Then Exit Sub 'nothing to do here, in case the ListBox contains no Markers
    
      'parse out the x,y Points (in Pixels) from the currently stored Lat-Lng-Strings in the Markers-ListBox
      ReDim PolyPoints(0 To lstMarkers.ListCount * 2 - 1) 'ensure proper space in our PolyArray (2 times the listcount)
      For i = 0 To lstMarkers.ListCount - 1
        strLatLng = Mid$(lstMarkers.List(i), 3)
        
        Lat = Val(Split(strLatLng, ",")(0))
        Lng = Val(Split(strLatLng, ",")(1))
        
        'convert and store the x,y-Pixel-Pairs in our Poly-Array now: (x at even, y at odd indexes)
        PolyPoints(2 * i + 0) = ucGMap1.LngToCanvasPxlX(Lng) 'that's our new Helper-Routine for the Mapping to Canvas-Pixels
        PolyPoints(2 * i + 1) = ucGMap1.LatToCanvasPxlY(Lat) '...dito here
      Next
      
      ucGMap1.SetLineWidthAndColor 3, vbBlue 'use the 3rd of our new Helper-Routines, to prepare for the following GDI-call
      Polyline hDC, PolyPoints(0), (UBound(PolyPoints) + 1) \ 2
    End Sub
    The needed API-Declare to place in the Demo-Form is this one:
    Code:
    Private Declare Function Polyline& Lib "gdi32" (ByVal hDC&, Points As Any, ByVal nCount&)
    Here's the Result (fully supporting all Zoom-Modes etc.)



    Since it is using good old GDI, you have currently no Antialiasing and no Alpha-Support
    on those PolyLines - but you could beautify all that by alternatively using GDI+ (or the vbRichClient)
    for those Drawings (also for drawing your own, nicer Markers for example, instead of using the ones
    provided by Google).

    Olaf
    Last edited by Schmidt; May 6th, 2015 at 03:35 AM.

  17. #17

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Schmidt View Post
    I assume you're already aware, that for any additional stuff you want to draw "On-Top" of the current Map,
    (as e.g. your own Markers or PolyLines) it is recommended to base those Drawings on Lat/Lng-Coords, to work properly.

    E.g. when you have a "GPS-based Travel-Companion" like a "Garmin-Device" (or an appropriate
    Application in your SmartPhone for that kind of stuff), and you import the GPS-Coords
    from your last "Bicycle-ride" from it - then you will already have the right "Base-Format".

    You're very kind.
    I want to tell you what I need, so you can help me best.
    Who uses my app has a resturant, and he wants to send some food to the client's home.
    So I have the address of both, but not the coordinates. My app should trace the route between them.
    How can I do?
    Thanks

  18. #18
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,072

    Re: VB6 WebBrowser problem... a serious problem!

    Sounds like what you get when you do a MapQuest from point A to point B


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  19. #19

    Thread Starter
    Lively Member saturnus83's Avatar
    Join Date
    Jan 2009
    Location
    Mantova, Italy
    Posts
    78

    Re: VB6 WebBrowser problem... a serious problem!

    Quote Originally Posted by Schmidt View Post
    I assume you're already aware, that for any additional stuff you want to draw "On-Top" of the current Map,
    (as e.g. your own Markers or PolyLines) it is recommended to base those Drawings on Lat/Lng-Coords, to work properly.

    E.g. when you have a "GPS-based Travel-Companion" like a "Garmin-Device" (or an appropriate
    Application in your SmartPhone for that kind of stuff), and you import the GPS-Coords
    from your last "Bicycle-ride" from it - then you will already have the right "Base-Format".

    The Points I currently store in the "MapPoints-ListBox" of the small Demo, also already fulfill
    that criterion - so (for convenience sake), I will use those Lat/Lng-Points in that ListBox for
    my example below (to draw a PolyLine from the Coords in that List).
    I can't use your control to trace a route between a source and a destination.
    How can I?
    Could you help me, please?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.