日期:2014-05-18  浏览次数:20886 次

麻烦前辈们,我这是哪错了啊
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;//声明调用API

namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  }
  [DllImport("user32", EntryPoint = "GetForegroundWindow")]
   
  public static extern int GetCapture();

  [DllImport("user32", EntryPoint = "GetWindowTextA")]

  public static extern string biaoti();

  public extern string biaoti(int hwn);
  public extern string biaoti(int hwn,string lpString);
  public extern string biaoti(int hwn,string lpString,int cc);
  private void button1_Click(object sender, EventArgs e)
  {
   
  }

  private void timer1_Tick(object sender, EventArgs e)
  {
  textBox1.Text = Convert.ToString(GetCapture());
   
   
  }
  }
}

错误提示

  {"未能从程序集“WindowsFormsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中加载类型“WindowsFormsApplication1.Form1”,因为方法“biaoti”没有实现(没有 RVA)。":"WindowsFormsApplication1.Form1"}

------解决方案--------------------
[DllImport("user32", EntryPoint = "GetForegroundWindow")]

public static extern int GetCapture();

[DllImport("user32", EntryPoint = "GetWindowTextA")]

public static extern string biaoti();

这些都不对。。。

话说你明白调用api的原理么?