473,484 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

P/Invoke calls with pointers

3 New Member
I´m noob with C++, i need the Visual Basic .NET (Compact Framework 1.1) P/Invoke calls of a Garmin Mobile XT API functions (http://developer.garmin.com/mobile/mobile-sdk/). I transforms others calls, but these with pointers and handles is too hard to me. Here is the info:


-- Function prototypes --
QueAPIExport QueErrT16 QueCreatePoint( const QuePointType* point, QuePointHandle* handle );
QueAPIExport QueErrT16 QueRouteToPoint( QuePointHandle point );

-- QueAPIExport --
#define QueAPIExport __declspec(dllimport)

-- QueErrT16 --
typedef uint16 QueErrT16; enum { ... }

-- QuePointType --
typedef struct { ... } QuePointType;

-- QuePointHandle --
typedef uint32 QuePointHandle;


The best try (i think) for me was (sending a IntPtr.Zero to first function, an error for sure):

<DllImport("QueAPI.dll")> _
Public Shared Function QueCreatePoint(ByRef point As QuePointType, ByRef handle As IntPtr) As QueErrT16
End Function

<DllImport("QueAPI.dll")> _
Public Shared Function QueRouteToPoint(ByVal point As IntPtr) As QueErrT16
End Function



If it can help, i will write a part of code (C++) of a person that makes a API Wrapper (http://christian-helle.blogspot.com/2008/02/integrating-with-garmin-mobile-xt.html). I want make

the same but in VB.Net:

QuePointType point;
QuePositionDataType position;

memset(&position, 0, sizeof(QuePositionDataType));
position.lat = DecimalDegreesToSemicircles(latitude);
position.lon = DecimalDegreesToSemicircles(longitude);

memset(&point, 0, sizeof(QuePointType));
point.posn = position;

QuePointHandle hPoint;
memset(&hPoint, 0, sizeof(QuePointHandle));

err = QueCreatePoint(&point, &hPoint);
if (err == queErrNone && hPoint != queInvalidPointHandle) {
err = QueRouteToPoint(hPoint);
}


I said i´m noob in C++, so i will tell you (maybe unneccessary) that nemset function is originally

from MEMORY.H and is prototype::

void * __cdecl memset(void *, int, size_t);



Thanks :)
Aug 25 '09 #1
0 1432

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4830
by: boxim | last post by:
hi all, I'm having a few problems whereby my application is hanging when using the Invoke method of a form's control. Basically, when a user clicks a button on the form, it calls a remote...
3
8844
by: David Logan | last post by:
I have an application using sockets, and it uses the asynchronous method for receiving (and others, but receiving is the basic problem.) In short, I want: class someClass: Form {...
19
6694
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many...
7
2105
by: Jeff Stewart | last post by:
I need a thread to run a subroutine which updates my main form's progress bar. I've properly marshaled all UI updates to the main UI thread, and after the main thread starts the worker thread, it...
1
4199
by: Steve | last post by:
I need to update my UI from a Process or worker thread. I did some readinf and basically ended up adapting an MS example to fot my needs. It all made sense until I tried it :) My process...
15
61943
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
5
3522
by: PiotrKolodziej | last post by:
Hi. I have a form. This form calls thread. Inside this thread i have while loop: while ((bufferCount = FileStream.Read(buffer, 0, 64000)) 0 && !Stop) { store += bufferCount;...
2
4382
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small...
3
3206
balabaster
by: balabaster | last post by:
I have a class that I want to make thread-safe and am investigating the ISyncronizeInvoke interface and wondering just what it will take to implement this interface. So far the basic concept of my...
0
7080
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7140
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5403
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4841
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
588
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
234
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.