473,608 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

char** to IntPtr() ?

1 New Member
I have to call a function. This is from the SDK:
INT is_GetActSeqBuf (HIDS hf, INT* pnNum, char** ppcMem, char** ppcMemLast);

I have demo C# code that works. Here is the prototype:
[DllImport(DRIVE R_DLL_NAME ,EntryPoint="is _GetActSeqBuf")]
private static extern int is_GetActSeqBuf (int hCam, ref int pnNum, ref IntPtr ppcMem, ref IntPtr ppcMemLast);

And this is the way it is used in the C# code.
IntPtr pMem = new IntPtr();
IntPtr pLast = new IntPtr();
is_GetActSeqBuf (hCam, pNum, pMem, pLast)

The C# code works. I used it to attempt a conversion to VB.NET by using the
http://authors.aspalliance.com/aldot...translate.aspx translation tool
and this is what it looks like:
Declare Function is_GetActSeqBuf Lib "ueye_api.d ll" Alias "is_GetActSeqBu f" (ByVal hCam As Integer, ByRef pnNum As Integer, ByRef ppcMem As IntPtr, ByRef ppcMemLast As IntPtr) As Integer

Dim pMem As New IntPtr()
Dim pLast As New IntPtr()
is_GetActSeqBuf (hCam, pNum, pMem, pLast)

It doesn't throw an exception, it just doesn't give a pointer back for pMem and pLast. VB.NET takes the IntPtr() as acceptable but indicates it doesn't support it for API's that return unsafe types.

I've been able to get other calls to the driver to work up to this point. Any suggestions?

Thanks.
Sep 15 '07 #1
1 4203
debasisdas
8,127 Recognized Expert Expert
Question moved to .NET forum .
Nov 3 '07 #2

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

Similar topics

15
10816
by: Yifan | last post by:
Hi Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks Yifan
7
2557
by: brian_harris | last post by:
I have a string object that I need to convert into an unmanged char * to be used by several unmnaged 3rd party functions. I have tried to use: (Marshal::StringToHGlobalAuto (Profname)) This would get me an IntPtr value, but I could not find the correct way to cast an IntPtr to an unmanged char *. One example I tried was: char *inifile; inifile = static_cast <char*> (Marshal::StringToHGlobalAuto (Profname)); It gave following compile...
5
7780
by: Stephen Cawood | last post by:
I'm trying to use a C++ .lib from C# (I tried the Interop group will no results). I have a working wrapper DLL (I can get back simple things like int), but I'm having issues dealing with an array of bytes. For example, the .lib contains this function: int create(int id, int scale, unsigned char *image); In the wrapper DLL I have this function:
3
11762
by: DG is a god.... | last post by:
Dear All , This is my first post - please go easy...! I have a DLL written in C++ that has the following function exported from it -: char** ListHandles(int *processID); The processID parameter is used to find all associated open file
0
1204
by: adityav | last post by:
Hi I have unmanaged code with following struct struct DirList { char **elements /* */ ; int32 *attributes /* */ ; int64 *mtime /* */ ; int64 *fsize /* */ ;
2
7296
by: runner | last post by:
I'm trying to call some functions from OpenSSL library but I'm a bit confused when I have to use pinvoke. first function should create key from some input data, it's declared : void BF_set_key(BF_KEY *key, int len, const unsigned char *data); I've translated it as public static extern IntPtr BF_set_key (IntPtr key, int len, byte data) and I try to call it this way:
3
6396
by: Elikhom | last post by:
Hi, I'm trying to call a C++ function that has a char** as a parameter from C# code using DllImport. After googling around and finding some threads I haven't been able to solve my problem. This is what I have... C++ side void populateRequiredIndexNames(char** names); C# side
5
3787
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);" I thought that it is very hard to memory map structure array. I need both read and write memory mapped file at both side of C# and C++.
20
2807
by: =?Utf-8?B?ZW1pdG9qbGV5ZXM=?= | last post by:
Hi everyone: i read from the documentation of a dll that there is a struct that uses char for storing an IP address. How can it be? and how come i can get to representate the same value in a string VB.NET data type, knowing that this is its equivalence (for char4)? Next is the data type definition '''unsigned char
0
8002
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8148
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8338
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6816
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6013
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3962
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2474
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
1
1594
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.