views:

55

answers:

3

In accessing PDH.dll (a Win32 API) (see link) using P/Invoke, it turns out that I need access to several constants and structs. I found these are defined inside a file PDH.h.

How do I access these defines and structs? Do I have to rewrite them with C#? Is there another way?

A: 

You have to rewrite them in C#.

Shaihi
On the plus side, more often than not it's a pretty trivial conversion!
Blindy
yeah but the code is pretty long
Louis Rhys
what's the -1 for?
Shaihi
+1  A: 

I think you have to rewrite them in C#

ZhengZhiren
+1  A: 

As already mentioned, you need to rewrite them in C#. But if you are lucky, someone will have already done them for you at PInvoke.net

Alternatively, you could try using the Interop Signature Toolkit, which can generate C# definitions from a C header file.

Phil Devaney
no it's not there :(
Louis Rhys