Looking for Windows API Definitions

  • Thread starter Thread starter Stewart Berman
  • Start date Start date
Stewart Berman said:
Where is the equivalent of the Windows.h (and it's includes) for C#?

If you are going to make a lot of calls into the Windows APIs, you may wish
to take a look at this site: http://pinvoke.net/

It will help you find the various [DllImport] declaractions and associated
data structures that you need to use when using Platform Invoke.
 
Thanks -- but all that is is information on calling the API functions from C++ not C#.
 
OK C# has using statements (the way java does) instead of include statements. Where are the type
descriptions for the Windows API?
 
Stewart said:
OK C# has using statements (the way java does) instead of include statements. Where are the type
descriptions for the Windows API?

..NET do not come with all of those.

In most cases the .NET FrameWork provides same functionality as
Win32 API.

I assume you have found the docs of the .NET FrameWork.

If you really need to use Win32 API from C#, then you can.
Somebody else has already posted a link to a site where you
can find the declarations.

Arne
 
Stewart said:
Where is the equivalent of the Windows.h (and it's includes) for C#?

http://pinvoke.net carries many of them and of other API headers, in C#
and in VB.NET syntax.

--
Rudy Velthuis http://rvelthuis.de

"Always code as if the guy who ends up maintaining your code will
be a violent psychopath who knows where you live."
-- Martin Golding
 
C# using statements are not equal to C++ include statements.

You have to add the the function imports, which can be found at pinvoke.net
as Alberto wrote.
 
That looks like you have to find each API function and all of the constants associated with it one
at a time and insert it. I am looking for the equivalent of either the Visual Studio 6 C++
Windows.h (and its includes) or the Visual Basic WIN32API.txt. Preferably updated for Vista.

Alberto Poblacion said:
Stewart Berman said:
Where is the equivalent of the Windows.h (and it's includes) for C#?

If you are going to make a lot of calls into the Windows APIs, you may wish
to take a look at this site: http://pinvoke.net/

It will help you find the various [DllImport] declaractions and associated
data structures that you need to use when using Platform Invoke.
 
I took another look -- it appears to include the enums for each function.

Thanks.

Alberto Poblacion said:
Stewart Berman said:
Where is the equivalent of the Windows.h (and it's includes) for C#?

If you are going to make a lot of calls into the Windows APIs, you may wish
to take a look at this site: http://pinvoke.net/

It will help you find the various [DllImport] declaractions and associated
data structures that you need to use when using Platform Invoke.
 
Stewart said:
Thanks -- but all that is is information on calling the API functions from C++ not C#.

Of course, but you could easily port them to C#. I mean, AFAIK it's only
a matter of using the DllImport attribute properly.

Regards.
 
Hello Stewart,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

The .NET is a new platform with a new programming architecture. It just
provides a parallel programming API similar as the traditional Windows API.
Consequently, the recommended way is always to use the .NET platform API
instead of the native Windows API if we can.

However, if the native Windows API is very necessary in case of some
particular scenario, the .NET has provided the P/Invoke as a bridge to
communicate between the native and managed codes. That is to say, the way
of calling Windows API has changed in C#. The header file has died in the
managed world.

Rudy and others joined in this discussion have already gave some useful
links about the PInvoke signatures and samples. Actually, I want to mention
another useful tool, the P/Invoke Interop Assistant. This tool provides a
visual UI that let you select a Windows API you want to call, or native
structure you want to use, and then it will generate and report the
corresponding DllImport attribute and data structure definition to us.

You can have a look at this MSDN magazine article about how to use the
P/Invoke Interop Assitant tool,
http://msdn.microsoft.com/en-us/magazine/cc164193.aspx

Please let me know if you need any future assistance and I will do my best
to follow up. Have a good day!


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top