Acessing WinAPI from C#
// August 16th, 2009 // Programming
The Windows API, informally WinAPI, is Microsoft’s core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows.
When declaring APIs in C#, use the following syntax:
using System.Runtime.InteropServices; ... [DllImport( dll_filename )] [public|private] static extern ret_type function( [type para, ...] );
Here sample to play sound that I get from www.csharpfriends.com
using System;
using System.Runtime.InteropServices;
namespace APITest
{
class clsAPI
{
[DllImport("winmm.dll")]
public static extern long PlaySound(string lpszName, long hModule, long dwFlags);
[STAThread]
static void Main(string[] args)
{
long retval;
string fname = "e:\\sounds\\hit.wav";
retval = PlaySound( fname, 0, 1 );
}
}
}
Now, how we can know what’s function inside dll?? check pinfoke.
by : Willy Achmat Fauzi




hi wats your myspace page
I would like to exchange links with your site wcode.net
Is this possible?