473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

C++ to C# type mapping....


Hello NewsGroup,

Does anyone know where I can find a table of some sort which shows a mapping
from C++ types to C# type equivelents? This would be most helpful for API
functions, structs, enums, constants,...etc. Learning and figuring this out
the hard way is good but sometimes suicidal.

EG:

C++ | C#
-----------------------------------
HWND | IntPtr
HINSTANCE | IntPtr
DWORD | Int32
LPCTSTR | String, IntPtr //[MarshalAs(UnmanagedType.LPStr)]
LPARAM | IntPtr, Int32
LPTSTR | String, (Seen someone StringBuilder that one.)
BYTE <-----Now that one's a beauty, I've seen that one as string, string
array, char, char array. Talk about being lost in translation.
INT_PTR | IntPtr
UINT_PTR | UIntPtr, IntPtr
LONG_PTR
WPARAM | IntPtr, Int32

Not that critical but I must admitt it would be great to have such a table,
don't you think?

Thanks NewsGroup.

Regards,
- SpotNet
Feb 6 '06 #1
3 9798

"SpotNet" <Sp*****@msnews.grp> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
|
| Hello NewsGroup,
|
| Does anyone know where I can find a table of some sort which shows a
mapping
| from C++ types to C# type equivelents? This would be most helpful for API
| functions, structs, enums, constants,...etc. Learning and figuring this
out
| the hard way is good but sometimes suicidal.
|
| EG:
|
| C++ | C#
| -----------------------------------
| HWND | IntPtr
| HINSTANCE | IntPtr
| DWORD | Int32
| LPCTSTR | String, IntPtr //[MarshalAs(UnmanagedType.LPStr)]
| LPARAM | IntPtr, Int32
| LPTSTR | String, (Seen someone StringBuilder that one.)
| BYTE <-----Now that one's a beauty, I've seen that one as string, string
| array, char, char array. Talk about being lost in translation.
| INT_PTR | IntPtr
| UINT_PTR | UIntPtr, IntPtr
| LONG_PTR
| WPARAM | IntPtr, Int32
|
| Not that critical but I must admitt it would be great to have such a
table,
| don't you think?
|
| Thanks NewsGroup.
|
| Regards,
| - SpotNet
|
|

Such tables are in the docs, check the "Platform Invoke Data Types".
Willy.
Feb 6 '06 #2

Hey Willy Denoyette thanks heaps...

- SpotNet

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:ON**************@TK2MSFTNGP12.phx.gbl...
:
: "SpotNet" <Sp*****@msnews.grp> wrote in message
: news:%2***************@TK2MSFTNGP10.phx.gbl...
: |
: | Hello NewsGroup,
: |
: | Does anyone know where I can find a table of some sort which shows a
: mapping
: | from C++ types to C# type equivelents? This would be most helpful for
API
: | functions, structs, enums, constants,...etc. Learning and figuring this
: out
: | the hard way is good but sometimes suicidal.
: |
: | EG:
: |
: | C++ | C#
: | -----------------------------------
: | HWND | IntPtr
: | HINSTANCE | IntPtr
: | DWORD | Int32
: | LPCTSTR | String, IntPtr //[MarshalAs(UnmanagedType.LPStr)]
: | LPARAM | IntPtr, Int32
: | LPTSTR | String, (Seen someone StringBuilder that one.)
: | BYTE <-----Now that one's a beauty, I've seen that one as string, string
: | array, char, char array. Talk about being lost in translation.
: | INT_PTR | IntPtr
: | UINT_PTR | UIntPtr, IntPtr
: | LONG_PTR
: | WPARAM | IntPtr, Int32
: |
: | Not that critical but I must admitt it would be great to have such a
: table,
: | don't you think?
: |
: | Thanks NewsGroup.
: |
: | Regards,
: | - SpotNet
: |
: |
:
: Such tables are in the docs, check the "Platform Invoke Data Types".
: Willy.
:
:
Feb 6 '06 #3
I've always found

http://www.pinvoke.net/

handy.

Scott

SpotNet wrote:
Hello NewsGroup,

Does anyone know where I can find a table of some sort which shows a mapping
from C++ types to C# type equivelents? This would be most helpful for API
functions, structs, enums, constants,...etc. Learning and figuring this out
the hard way is good but sometimes suicidal.

EG:

C++ | C#
-----------------------------------
HWND | IntPtr
HINSTANCE | IntPtr
DWORD | Int32
LPCTSTR | String, IntPtr //[MarshalAs(UnmanagedType.LPStr)]
LPARAM | IntPtr, Int32
LPTSTR | String, (Seen someone StringBuilder that one.)
BYTE <-----Now that one's a beauty, I've seen that one as string, string
array, char, char array. Talk about being lost in translation.
INT_PTR | IntPtr
UINT_PTR | UIntPtr, IntPtr
LONG_PTR
WPARAM | IntPtr, Int32

Not that critical but I must admitt it would be great to have such a table,
don't you think?

Thanks NewsGroup.

Regards,
- SpotNet

Feb 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Steven Bethard | last post by:
I tried to Google for past discussion on this topic, but without much luck. If this has been discussed before, I'd be grateful for a pointer. Does anyone know why you can't assign a custom...
1
by: Tomi Laamanen | last post by:
we have problems in WebService -> .NET response Response look OK in XMLSpy and tcpTrace <m:AGW014N1Response xmlns:m="urn:com-softwareag-entirex-rpc:AGW014N1"><ArrayOfMAA...
51
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is...
1
by: Mike Strieder | last post by:
How can i get the text of the System.Type e.g. "base64Binary" from the .Net type "byte" I can not found any Function to give back this Schematype as string. thx for your help
0
by: Joel | last post by:
Hello: I have some question about some data type mapping for some data type of my c++ dll Data Type Mapping ----------------------------------- type are time_t tm char *message
2
by: Tony Cox | last post by:
Hi. I'm new to VB.NET, so please be gentle ;-) I'm trying to transfer VB.NET structures to a shared memory area at a fixed location in process memory space. The structures themselves consist of...
3
by: John Glover | last post by:
To whoever can help, Is there a way to get the Xml schema for a user defined type at runtime? I've looked at the XmlSerializer as I had hoped there might be a way to retrieve it. I've also...
2
by: Nigel Sampson | last post by:
Hi, I'm in the process of upgrading an Object-Relational mapping library to .NET 2.0 and am wanting to implement support for Nullable typess. I'm using Reflection to analyise the object that is...
4
by: Samuel | last post by:
Hi, I am trying to replace the eval() in the following code: def myfunc(type, table): module = __import__(type) type = 'module' + '.' + type obj = eval(type) return obj(row, row)
1
by: ebusiness | last post by:
I am trying to create nicknames for tables in a remote database. The federated database and remote database are both DB2 UDB V8.2, both OS are AIX. Could anyone tell me how to create a nickname...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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...

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.