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

S

SpotNet

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
 
W

Willy Denoyette [MVP]

|
| 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.
 
S

SpotNet

Hey Willy Denoyette thanks heaps...

- SpotNet

:
: : |
: | 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.
:
:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top