471,325 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 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 9671

"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Steven Bethard | last post: by
51 posts views Thread by jacob navia | last post: by
1 post views Thread by Mike Strieder | last post: by
2 posts views Thread by Nigel Sampson | last post: by
reply views Thread by rosydwin | last post: by

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.