⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 Professional C# 2nd Edition
💻 CS
字号:
using System;
using System.Runtime.InteropServices;

namespace Wrox.ProCSharp.ComInterop.UnmanagedExample
{
	class PInvokeExample
	{
		//Declare the external, unmanaged function.
		//[DllImport ("user32.dll")]
		// Uncomment the next line and comment the above line to create an alias
		[DllImport("user32.dll",EntryPoint="MessageBoxA")]
		public static extern int ErrorMessage (int Modal,
			string Message,
			string Caption,
			int Options);
   
		//Program starts here.
		public static void Main (string[] args)
		{
			//Invoke the unmanaged function using PInvoke.
			//MessageBoxA(0,"PInvoke worked!","PInvoke Example",0);
			// Uncomment the next line, and comment the above line to use the alias
		   ErrorMessage(0, "PInvoke worked with alias name!", "PInvoke Example",0);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -