call system dll method in csharp application.
in this example we are using User32.dll file.
using System;
using System.Runtime.InteropServices;
class DllImportDemo
{
[DllImport("User32.dll", EntryPoint="MessageBox")]
static extern int MessageDialog(int inthWnd,string strmsg,string strCaption,int intMsgType);
[STAThread]
static void Main(string[] args)
{
MessageDialog(0, "MessageDialog is Called!", "DllImport Demo", 1);
}
}
No comments:
Post a Comment