Results 1 to 5 of 5

Thread: D3 in C# application

  1. #1
    Low Bitrate jadz's Avatar
    Join Date
    Apr 2004
    Posts
    58

    D3 in C# application

    Does anyone have an example of D3 in a C# application... or in any .NET language? Most of the examples I've seen were compatible with the D2 SDK and I can't seem to get them to compile though I may be doing something wrong.

  2. #2
    Raw Wave Laidback's Avatar
    Join Date
    Oct 2003
    Location
    Madrid
    Posts
    1,984
    Some VB if you can work it out from there!

    Code:
    Public g_Dest As Object
    Private Sub Create_Click()
    Set g_Dest = CreateObject("DestDll.Dest") ', "Dest_")
    g_Dest.ParentWindow = hWnd
    res = g_Dest.CreateDestinatorWindow(F_DEFAULT) 'F_NOCAPTION + F_NOSYSMENU) ' + F_NOCONTROLS) '(F_DEFAULT)
    End Sub
    Private Sub Hide_Click()
    Dim res As Long
    res = g_Dest.HideDestinatorWindow()
    End Sub
    Private Sub Show_Click()
    Dim res As Long
    res = g_Dest.ShowDestinatorWindow()
    End Sub
    Code:
    Dim WithEvents d As DESTDLLLib.Dest
    Dim Buf As DrumBuffer
    Dim Source As DrumBuffer
    
    
    Private Sub CloseComPOrt_Click()
        MSComm1.PortOpen = False
        d.SetGPSPortSource Nothing
        d.OpenGPSPort
    End Sub
    
    Private Sub Command1_Click()
    Dim dis As DESTDLLLib.DestPoint
        Set dis = New DESTDLLLib.DestPoint
        dis.Latitude = 40.4658
        dis.Longtitude = -3.5937
        dis.Description = "TestDis"
    Dim fName As String
    fName = "Wap"
    
        'd.GetAddressFromCoordinates dis
                    d.AddPointToFavoritFolder fName, dis
    'MsgBox dis
    End Sub
    
    Private Sub ConnectGPS_Click()
        d.SetGPSPortTarget Buf
        Timer1.Enabled = True
    End Sub
    
    Private Sub d_OnDestinatorEvent(ByVal EventCode As Long)
        Debug.Print "d event = " & EventCode
    End Sub
    
    Private Sub DisconnectGPS_Click()
        Timer1.Enabled = False
        d.SetGPSPortTarget Nothing
    End Sub
    
    Private Sub Form_Load()
        Set d = New DESTDLLLib.Dest
        d.ParentWindow = hWnd
        Dim n As Long
        n = 26 'F_NOCAPTION Imp F_SHOW_ABOUT_DLG Imp F_SHOW_EXIT_DLG
        d.CreateDestinatorWindow 26
        'd.ShowDestinatorWindow
        'd.HideDestinatorWindow
        d.EnableTMC hWnd
        d.OnMapInformation = 15
        n = d.VisualNotification
        
        Set Buf = New DrumBuffer
        Buf.SetSize 10000
        
        Set Source = New DrumBuffer
        Source.SetSize 10000
        
        Dim s As String
        Dim dis As DESTDLLLib.DestPoint
        Set dis = New DESTDLLLib.DestPoint
        dis.Latitude = 32.1613
        dis.Longtitude = 34.80723
        d.GetAddressFromCoordinates dis
        
        s = dis.Street
        d.MPRNavigate "GILI", 1
        
        Dim nIndex As Long
        For n = 0 To d.CityCount
             If d.GetCityNameFromID(n) = "Ari'el" Then nIndex = n
        Next n
        Dim ar As DestIDArray
        'Set ar = New DestIDArray
        Set ar = d.GetArrayOfStreetsIDForCity(nIndex)
        Dim nIndexMS As Long
        Dim nIndexME As Long
        
        Dim StreetID As Long
        
        For n = 0 To ar.ItemCount - 1
             StreetID = ar.Item(n)
             If d.GetStreetNameFromID(StreetID) = "Tsahal" Then nIndexMS = StreetID
             If d.GetStreetNameFromID(StreetID) = "Barak" Then nIndexME = StreetID
        Next n
        
        Set dis = d.GetCoordinatesOfStreetIntersection(nIndex, nIndexMS, nIndexME)
        Debug.Print dis.Latitude
        'Maneuver list
        Dim man As DESTDLLLib.DestManeuverList
        Set man = d.GetManeuverList
        'Debug.Print "Distance=" & CStr(man.RouteDistance)
        Dim ManId As Long
        For n = 0 To man.ManeuverCount - 1
    '        ManId = man.ManeuverID(n)
            s = man.CorrespondingStreetName(n)
            
            'Debug.Print "Street=" & s & " Distance=" & man.DistanceToManeuver(n)
        Next n
        d.RemovePointFromFavoritFolder "eee", "fff"
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    'd.ShowDestinatorWindow
    'd.CreateDestinatorDialog DESTINATOR_EXIT_DLG
        Set Buf = Nothing
        Set Source = Nothing
        Set d = Nothing
    End Sub
    
    Private Sub MSComm1_OnComm()
        Dim s As Variant
        If MSComm1.CommEvent = comEvReceive Then
            s = MSComm1.Input
            Source.WriteData s
            
        End If
    End Sub
    
    Private Sub OpenCommPort_Click()
        d.CloseGPSPort
        d.SetGPSPortSource Source
        MSComm1.PortOpen = True
    End Sub
    
    Private Sub Timer1_Timer()
        Dim n As Long
        Dim ar() As Byte
        n = Buf.GetSize
        ar = Buf.ReadData(1)
        Dim s As String
        If UBound(ar, 1) > 0 Then
            Log.Text = Log.Text + vbNewLine
            For n = LBound(ar, 1) To UBound(ar, 1)
            If ar(n) <> 0 Then s = s + Chr(ar(n))
            Next n
            Log.Text = s
        End If
    End Sub

  3. #3
    Low Bitrate jadz's Avatar
    Join Date
    Apr 2004
    Posts
    58
    Any chance you could .zip that project and attach it to this thread?

  4. #4
    Raw Wave Laidback's Avatar
    Join Date
    Oct 2003
    Location
    Madrid
    Posts
    1,984
    Yep
    Attached Files Attached Files

  5. #5
    Low Bitrate jadz's Avatar
    Join Date
    Apr 2004
    Posts
    58

    Another Example

    Another example from another thread
    Attached Files Attached Files

Similar Threads

  1. Replies: 2
    Last Post: 11-05-2004, 06:24 PM
  2. How do I import Speedcam's into D3 1.1
    By CdRsKuLL in forum GPS
    Replies: 13
    Last Post: 10-25-2004, 08:39 PM
  3. Embedding a backup application
    By l0gic in forum MediaCar
    Replies: 2
    Last Post: 10-22-2004, 05:55 AM
  4. Cdplayer application
    By kreyzig in forum FrodoPlayer
    Replies: 2
    Last Post: 06-19-2004, 11:51 PM
  5. More than one external application?
    By KlereBak in forum ME Archive
    Replies: 2
    Last Post: 02-12-2003, 08:31 PM

Bookmarks

Posting Permissions

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