Для использования в программе API-функций надо, во-первых, добавить постранство имен System.Runtime.InteropServices, во-вторых, добавить заголовок нужной API-функции и в-третьих, вызвать ее в нужном месте.
Код:
using System;
...
//Добавление пространства имен
using System.Runtime.InteropServices;
...
//Добавление заголовка
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd,
String strMessage, String strCaption, uint uiType);
...
private void button1_Click(object sender, System.EventArgs e)
{
//Вызов API-функции
MessageBox(0, "Hello!", "Caption", 0);
}
...
В указанном примере при нажатии на кнопку выскочит MessageBox (путем вызова соответствующей API-функции).
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete