There are few thumbrules to make API calls :-
1:- MethodName is the name of the API to call.
2:- DllName is the name of the DLL.
3:- Args are any arguments to the API call.
4:- Type is the return type of the API call.
partial class Form1 : Form
{
[DllImport(“Kernel32.dll”)]
static extern int Sleep(long dwMilliseconds);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show(“Starting of 5000 ms...”);
Sleep(5000);
MessageBox.Show(“End of 5000 ms...”);
}
}
}
0 comments:
Post a Comment