1、usingSystem;usingSystem.Collections.Generic;usingSystem.Compon髫潋啜缅entModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Runtime.InteropServices;namespaceWinAPISample{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbtnClear_Click(objectsender,EventArgse){SHEmptyRecycleBin(Form.ActiveForm.Handle,"", 0x00000000);}privatevoidbtnMax_Click(objectsender,EventArgse){ShowWindow(Form.ActiveForm.Handle, 3);}privatevoidbtnMin_Click(objectsender,EventArgse){ShowWindow(Form.ActiveForm.Handle, 2);}privatevoidbtnNormal_Click(objectsender,EventArgse){ShowWindow(Form.ActiveForm.Handle, 1);}privatevoidbtnBrowser_Click(objectsender,EventArgse){ShellExecute(Form.ActiveForm.Handle,"Open",this.tbURL.Text,"","", 1);} ///<summary>///清空回收站///</summary>[DllImport("shell32.dll", EntryPoint ="SHEmptyRecycleBin", CharSet =CharSet.Auto)]publicstaticexternlongSHEmptyRecycleBin(IntPtrhwnd,stringpszRootPath,longdwFlags);///<summary>///打开浏览器///</summary>[DllImport("shell32.dll", EntryPoint ="ShellExecute", CharSet =CharSet.Auto)]publicstaticexternintShellExecute(IntPtrhwnd,stringlpOperation,stringlpFile,stringlpParameters,stringlpDirectory,intnShowCmd);///<summary>///最大化窗口,最小窗口,正常大小窗口///</summary>[DllImport("user32.dll", EntryPoint ="ShowWindow", CharSet =CharSet.Auto)]publicstaticexternintShowWindow(IntPtrhwnd,intnCmdShow);}}