using System.Runtime.InteropServices;public class Form1 : System.Windows.Forms.Form
{[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public extern static long DeleteFile(String lpFileName);}

解决方案 »

  1.   

    忘记写调用了
    DeleteFile("c:\\ss.txt");
      

  2.   

    http://www.ccw.com.cn/htm/center/prog/02_10_9_6.asp手把手教你;)
      

  3.   

    public class Form1: Form
    {
    // 此方法用来设置当前获取焦点的控件,当然 .Net 中有更简单且直接的方法。
    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    private static extern IntPtr SetFocus(IntPtr hWnd);...private ListView lv;...private void button1_Click(object sender, EventArgs e)
    {
       if (this.lv != null)
         SetFocus(this.lv.Handle);    // 调用了 Win32API 来实现。// 简单的实现应该是 this.lv.Focus(); 
    // 然而从本质上讲,此 .NET 方法也是调用了同样的 Win32API。}
    }