Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using Visual Basic.NET 2003 ActiveX DLL in Borland C++ Builder 6

Posted on 2004-11-17
3
Medium Priority
?
487 Views
Last Modified: 2013-11-17
Hi,
   I have created a Visual Basic DLL and it's type library file.  These dll's are used to control MapPoint Maps.  I loaded the type library into C++ Builder and the ActiveX component appeared.  I added an instance of the object to my form and then compiled.  Everything worked fine except the activeX component doesn't appear.  The component gets declared as
      TMapPointDLL MapPointDLL;

I try to access the functions that are in that DLL, and they aren't there.  I tried to Load the Library manually and then get the ProcAddress of the functions, but that always returns NULL.  I am very stuck and need assistance on how to get this DLL to work.  Thanks

Ronald
0
Comment
Question by:pwi11
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Cayce earned 1500 total points
ID: 12699838
The VB.NET DLL contains no standard exports.

You'll need to do all the work thru ActiveX.

Could you post (partly) you code in VB to see that are you trying to export and what's not showing in BCB?
0
 
LVL 9

Expert Comment

by:Cayce
ID: 12967609
Any updates on this Roland?
0
 

Author Comment

by:pwi11
ID: 13146264
Hey, sorry this took so, that project got put on hold for a while, but I'm back on it.  Here is some of what I'm trying to do.
I'm actually trying to create a VB MapPoint DLL so that I can do my own event handling.  Thus far I got MapPoint integrated directly into Borland, but I haven't been able to force it to allow me to handle mouse events on the map, only the MapPoint controls are available.  The code I have here isn't doing the map events, the dll is simply displaying the map.  So far the only responses I have received have been that I need to create this DLL, yet nobody has been able to tell me how.  So here is what I've done so far.  (BTW it seems that when u use MapPoint in Borland, you actually have a handle to much more than just the map control, this is why I can't customize the events)

This code is simply designed to let me add pushpins to the map, nothing more.  Thanks for your help Cayce, I appreciate it, sorry for the delay

Option Strict Off
Option Explicit On
<System.Runtime.InteropServices.ProgId("MapPointDLL.mapPointDLL")> Public Class MapPointDLL
    Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'UserControl1 overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents AxMappointControl1 As AxMapPoint.AxMappointControl
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(MapPointDLL))
        Me.AxMappointControl1 = New AxMapPoint.AxMappointControl
        CType(Me.AxMappointControl1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'AxMappointControl1
        '
        Me.AxMappointControl1.Enabled = True
        Me.AxMappointControl1.Location = New System.Drawing.Point(8, 8)
        Me.AxMappointControl1.Name = "AxMappointControl1"
        Me.AxMappointControl1.OcxState = CType(resources.GetObject("AxMappointControl1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.AxMappointControl1.Size = New System.Drawing.Size(336, 328)
        Me.AxMappointControl1.TabIndex = 0
        '
        'UserControl1
        '
        Me.Controls.Add(Me.AxMappointControl1)
        Me.Name = "UserControl1"
        Me.Size = New System.Drawing.Size(352, 344)
        CType(Me.AxMappointControl1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub MapPointDLL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim objMap As MapPoint.Map
        Dim objLoc As MapPoint.Location

        'Open a North American map
        Dim geoMapNorthAmerica As Object
        Me.AxMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica)

        'Set the map object to the current map
        objMap = AxMappointControl1.ActiveMap
        'Set the location to Latitude 15.0000, Longitude 0.0000, Altitude 35,000 miles
        objLoc = objMap.GetLocation(15, 0, 35000)
        'Move to the location settings
        objLoc.GoTo()

        'Set the projection so that you will see a globe instead
        'of a flat map at higher altitudes
        objMap.Projection = MapPoint.GeoMapProjection.geoGlobeViewWhenZoomedOut

        'Change the map style to the Political style
        objMap.MapStyle = MapPoint.GeoMapStyle.geoMapStylePolitical

        'Set the font to the smallest size
        objMap.MapFont = MapPoint.GeoMapFont.geoMapFontSmallest
    End Sub

    Public Function SetFlat(ByVal bool As Boolean)
        Dim objMap As MapPoint.Map

        'Set the map object to the current map
        objMap = AxMappointControl1.ActiveMap

        If bool = True Then
            'Set the projection so that you will see a flat map instead
            'of a globe at higher altitudes
            objMap.Projection = MapPoint.GeoMapProjection.geoFlatViewWhenZoomedOut
        Else
            'Set the projection so that you will see a globe instead
            'of a flat map at higher altitudes
            objMap.Projection = MapPoint.GeoMapProjection.geoGlobeViewWhenZoomedOut
        End If
    End Function

    Public Function GotoLocation(ByVal Latitude As Double, ByVal Longitude As Double, ByVal Altitude As Double)
        Dim objMap As MapPoint.Map
        Dim objLoc As MapPoint.Location

        'Set the map object to the current map
        objMap = AxMappointControl1.ActiveMap

        'Check to make sure the Latitude is within allowable range
        If Latitude < -90 Or Latitude > 90 Then
            MsgBox("Latitude outside of allowable range!")
            Exit Function
        End If

        'Check to make sure the Longitude is within allowable range
        If Longitude < -180 Or Longitude > 180 Then
            MsgBox("Longitude outside of allowable range!")
            Exit Function
        End If

        'Check to make sure the Altitude is within allowable range
        If Altitude < 1 Or Altitude > 50000 Then
            MsgBox("Altitude outside of allowable range!")
            Exit Function
        End If

        objLoc = objMap.GetLocation(Latitude, Longitude, Altitude)

        'Move to the location settings
        objLoc.GoTo()
    End Function

    Public Function AddPushpin(ByVal Latitude As Double, ByVal Longitude As Double, ByVal Label As String)
        Dim objMap As MapPoint.Map
        Dim objLoc As MapPoint.Location

        objMap = AxMappointControl1.ActiveMap

        objLoc = objMap.GetLocation(Latitude, Longitude)
        objMap.AddPushpin(objLoc, Label)
    End Function
End Class


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question