Re: NotSupportedException TomTomSDK

Tech-Archive recommends: Speed Up your PC by fixing your registry



Ok, that indeed does the trick.

One more question:

TTNCom_GetLocationInfoV01( long aLongitude, long aLatitude,
CTomTomNavigatorCom::TLocationInfoV01 &aLocInfo );
where the Locationinfo parameter is an structure:

struct TLocationInfoV01
{
int iType;
TCHAR iStreetName[128];
int iHouseNr1, iHouseNr2;
};

Any ideas how to declare the TCHAR? (or should i use an other datatype?)

Declaration
[DllImport("TTNCom.dll", EntryPoint = "TTNCom_GetLocationInfoV01",
SetLastError=true)]
public extern static int GetLocationInfoV01( int aLongitude, int aLatitude,
ref TLocationInfoV01 aLocInfo);

"Peter Foot [MVP]" <feedback@xxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:eYMKTKa0FHA.1028@xxxxxxxxxxxxxxxxxxxxxxx
> Each of those is a pointer , the first to an enumeration and the second to
a
> custom structure - you'll be able to tell from the .h files the layout of
> this structure. You have two options, if the structures are simple you can
> either declare them as a struct in managed code and pass by ref, or
declare
> as a class and pass directly (classes are byref by nature), the other
option
> is to use a byte array of the correct size for the native struct layout
> (useful if the structure contains inline strings for example) and then use
> the BitConverter and Buffer classes to extract the data from the relevant
> places in the byte array. My recollection of the LocationV01 struct is
that
> it's simple with all integer members so you can declare as a struct in
> managed code, you'll also need to define the enum in your managed code to
> match that in the .h file, then your P/Invoke will look like:-
>
> DllImport("TTNCom.dll", EntryPoint = "TTNCom_GetCurrentPositionV01",
> SetLastError=true)]
> private static extern int TTNCom_GetCurrentPositionV01( ref EGpsStatus
> aStatus, ref TTTnLocationV01 aLocation );
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> http://www.inthehand.com | http://www.peterfoot.net
>
> "Jeroen" <no@xxxxxxxx> wrote in message
> news:11l26d71e2tqjd7@xxxxxxxxxxxxxxxxxxxxx
> > Do you also know how to declare and use the
> >
> > TTNCom_GetCurrentPositionV01( CTomTomNavigatorCom::EGpsStatus &aStatus,
> > CTomTomNavigatorCom::TTTnLocationV01 &aLocation );
> >
> > because this one doesn't use "normal" parameters
> >
> > "Peter Foot [MVP]" <feedback@xxxxxxxxxxxxxxxxxxxx> schreef in bericht
> > news:uHuYJkY0FHA.3720@xxxxxxxxxxxxxxxxxxxxxxx
> >> In .NETCF you can't marshal a long (Int64) by value, only pass it by
> >> reference. However a long in C++ is a 32bit value (Int32 / int in c#)
so
> > you
> >> can change your code to:-
> >>
> >> DllImport("TTNCom.dll", EntryPoint = "TTNCom_ShowCoordinatesOnMap",
> >> SetLastError=true)]
> >> public extern static int ShowCoordinatesOnMap(int aLongitude, int
> >> aLatitude );
> >>
> >> Peter
> >>
> >> --
> >> Peter Foot
> >> Windows Embedded MVP
> >> http://www.inthehand.com | http://www.peterfoot.net
> >>
> >> "Jeroen" <no@xxxxxxxx> wrote in message
> >> news:11l1uqlti40jg43@xxxxxxxxxxxxxxxxxxxxx
> >> > Hello,
> >> >
> >> > I've got some trouble with the tomtom 3 sdk.
> >> >
> >> > I'm currently trying the possiblities, and i only get the functons
that
> >> > don't use parameters to work:
> >> >
> >> > [DllImport("TTNCom.dll", EntryPoint =
> >> > "TTNCom_BringNavigatorToForeground")]
> >> > public extern static void BringNavigatorToForeground();
> >> >
> >> > If i call this, it works great.
> >> >
> >> > But when i call this function:
> >> > [DllImport("TTNCom.dll", EntryPoint = "TTNCom_ShowCoordinatesOnMap",
> >> > SetLastError=true)]
> >> > public extern static int ShowCoordinatesOnMap( long aLongitude, long
> >> > aLatitude );
> >> > i get an NotSupportedException
> >> > i read the documentation and i call it this way:
> >> >
> >> > long lon = (long)5257996;
> >> > long lat = (long)51788699;
> >> > try
> >> > {
> >> > ShowCoordinatesOnMap(lon,lat);
> >> > }
> >> > catch (Exception ex)
> >> > {
> >> > MessageBox.Show(ex.Message);
> >> > }
> >> >
> >> > this is what the documentation says for the C++ function:
> >> > 6.2.14. INT ShowCoordinateOnMap( long aLongitude, long aLatitude)
> >> > Command Parameters:
> >> > . long aLongitude: longitude specified in WGS84 format (in millionths
> >> > of
> >> > degree)
> >> > . long aLatitude: latitude specified in WGS84 format (in millionths
of
> >> > degree)
> >> > Returns: 0 if successful, non-zero value otherwise.
> >> > Supported Since: TTN 1.42
> >> > Centers the map around the given coordinate (zoomed in), specified in
> >> > WGS84
> >> > format (longitude and
> >> > latitude in millionths of degree).
> >> > Example:
> >> > INT error = CTomTomNavigatorCom::ShowCoordinateOnMap(4860000,
> >> > 52380000);
> >> > 6. Communicating with TomTom Navigator from C++
> >> > 31
> >> > if (error)
> >> > {
> >> > ::AfxMessageBox(TEXT("Failed to center around a point in
Amsterdam"));
> >> > }
> >> >
> >> >
> >> > So'm pretty sure the parameters itself are correct.
> >> > Any ideas as to what i'm doing wrong?
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>


.



Relevant Pages