473,549 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ 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.garmi n.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(dlli mport)

-- 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("Que API.dll")> _
Public Shared Function QueCreatePoint( ByRef point As QuePointType, ByRef handle As IntPtr) As QueErrT16
End Function

<DllImport("Que API.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;
QuePositionData Type position;

memset(&positio n, 0, sizeof(QuePosit ionDataType));
position.lat = DecimalDegreesT oSemicircles(la titude);
position.lon = DecimalDegreesT oSemicircles(lo ngitude);

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

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

err = QueCreatePoint( &point, &hPoint);
if (err == queErrNone && hPoint != queInvalidPoint Handle) {
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 1440

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

Similar topics

1
4841
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 function, which in turn fires an event that is caught by the form. The form then need to add a value passed in the event to a form object, however,...
3
8856
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 { mySocketClass sss; ...
19
6697
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 happen in function calls from invoicePrintingLongRunningCodeThread. I need just an example in
7
2113
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 waits for the worker thread to complete by means of a while t.isAlive, sleep(0) mechanism. But when my worker thread calls my UpdateProgressBar...
1
4210
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 makes calls to a Singleton logger class which in turn makes calls to a delegate to add items to a listbox in my WinForm. Here is the code that I have...
15
61987
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
3525
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; file.Write(buffer, 0, bufferCount); // Update information on control
2
4398
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 or simple). I am hoping the description will generate some ideas I can check out. PROBLEM: ----------------- Switching to UI thread using...
3
3217
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 code is: Public Class MyClass1 Implements System.ComponentModel.ISynchronizeInvoke Private _InvokeRequired As Boolean = False ...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7808
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6040
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
757
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.