473,516 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Marshal, MarshalAs

1 New Member
Hi all,

I have been struggling with an API call from C# now for at least 8 hours, and I need some assistance of what is happening - I do not need code examples, just an understanding of what is happening...

Expand|Select|Wrap|Line Numbers
  1. long STDCALL DT_GetInfo(U32 deviceHandle, enum eITEMType ITEMType, void *pITEMS)
and the parameters are as follows:

Expand|Select|Wrap|Line Numbers
  1. U32 hDev
  2.    Item handle
  3. enum eITEMype ITEMType
  4.    UI_DATASTATE 
  5. void *pITEMS
  6.    Pointer to the user interface structure buffer (provided by the application)
and the enum parameter number 2 is one enumeration of items using another enumerations of each items current state...

Now my problem is with the enum and void pointer, on how to Marshal these data correctly... Actually I just need to know what the function does and how I will implement it in C#.

Thank you, any advice or insight will be appreciated.
May 29 '09 #1
0 1578

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

Similar topics

1
3932
by: alfacom | last post by:
Hi, I have two C++ structures like these : typedef struct answer_series_item { int32_t contract_size_i; int32_t price_quot_factor_i; char ins_id_s ; char isin_code_s ; uint8_t suspended_c;
0
8747
by: Mo | last post by:
I am having problem with marshaling struct in C#. //the original C++ struct typedef struct _tagHHP_DECODE_MSG { DWORD dwStructSize; // Size of decode structure. TCHAR pchMessage; // decoded message data TCHAR chCodeID; // AIM Id of symbology TCHAR chSymLetter; ...
7
5944
by: Mo | last post by:
I am having problem with marshaling struct in C#. //the original C++ struct typedef struct _tagHHP_DECODE_MSG { DWORD dwStructSize; // Size of decode structure. TCHAR pchMessage; // decoded message data TCHAR chCodeID; // AIM Id of symbology TCHAR chSymLetter; ...
2
11624
by: zDog | last post by:
I found a lot of information on passing data from C# to a C++ dll What I cannot find is a way to return C++ structs of TCHAR string data back to the C# managed code! typedef struct // C++ data that needs to be returned to the caller (C#) { short snOperParams; TCHAR szNFPath; TCHAR szSSFile; TCHAR szExeFile;
5
4307
by: Daniel Brown | last post by:
I am coding a managed C# wrapper for an unmanaged C DLL and I am unable to marshal a structure that contains an array of structures. When executed, the following code throws an ArgumentException with a description “Type ErrorInjectionBuffer can not be marshaled as an unmanaged structure; no meaningful size or offset can be computed.” I...
6
10796
by: SB | last post by:
I feel dumb to ask because I bet this is a simple question... Looking at the code below, can someone please explain why I get two different values in my Marshal.SizeOf calls (see the commented lines)? TIA! sb
2
4843
by: twawsico | last post by:
I have a piece of code that needs to read the contents of a binary file (that I've created with another app) into an array of structures. The binary data in the file represents just a series of singles that correspond to those in my structure detailed below. So when I load the file, all that I know for certain is that there will be some...
4
6461
by: gpg | last post by:
I am using a legacy DLL and need to marshal some structures for use in the DLL. For the most part, I have figured out my needs except for one small item. I have a structure that contain, among other items, an array of bools (not BOOL). The array is a fixed size and is contained in the structure. Should be simple ie:
1
2723
by: spamacon | last post by:
Hello, I have a strange situation using .Net FW 1.1. I want to use Marshal.PtrToStructure to fill the structure below. The first 3 fields get filled correctly: ulStruct describes how big the structure is in bytes (120 bytes, assuming 32-bit IntPtrs), pWmSnapshot gets 0, and usNumWmSnapshots gets 0. The next field, pICView, is a pointer to...
0
1461
by: bumbala | last post by:
Below is my unmanaged structure: public struct LasHeader { public string FileSignature;
0
7182
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...
1
7142
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...
0
7548
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
4773
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...
0
3267
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...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
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
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
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.