为什么我在vs2005中无法调用系统api函数
我的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace testaaa
{
[DllImport("user32.dll",EntryPoint="SendMessageA")]
public static extern long SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
错误提示:
------ 已启动生成: 项目: testaaa, 配置: Debug Any CPU ------
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\testaaa.exe /resource:obj\Debug\testaaa.Form1.resources /resource:obj\Debug\testaaa.Properties.Resources.resources /target:winexe Form1.cs Form1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs
E:\work.exe\workspace\testaaa\testaaa\Form1.cs(13,26): 错误 CS1518: 应输入 class、delegate、enum、interface 或 struct
E:\work.exe\workspace\testaaa\testaaa\Form1.cs(12,55): 错误 CS0106: 修饰符“extern”对该项无效
编译完成 -- 2 个错误,0 个警告
========== 生成: 0 成功或最新,1 失败,0 被跳过 ==========