问题描述
我个人所知:1.通过DllImport调用Win32API;2.通过对应表在.NETAPI中查找对应Win32API而然后直接使用.NETAPI。对应表引用地址如下:http://www.cnblogs.com/me-sa/articles/657251.html除了以上的两种的以外还有其它的不?两种方法例程如下:usingSystem;usingSystem.Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;usingSystem.Drawing.Imaging;namespaceWin{///<summary>///Form1的摘要说明。///</summary>publicclassForm1:System.Windows.Forms.Form{privateSystem.Windows.Forms.Buttonbutton1;privateSystem.Windows.Forms.Buttonbutton2;///<summary>///必需的设计器变量。///</summary>privateSystem.ComponentModel.Containercomponents=null;publicForm1(){////Windows窗体设计器支持所必需的//InitializeComponent();////TODO:在InitializeComponent调用后添加任何构造函数代码//}///<summary>///清理所有正在使用的资源。///</summary>protectedoverridevoidDispose(booldisposing){if(disposing){if(components!=null){components.Dispose();}}base.Dispose(disposing);}#regionWindowsFormDesignergeneratedcode///<summary>///设计器支持所需的方法-不要使用代码编辑器修改///此方法的内容。///</summary>privatevoidInitializeComponent(){this.button1=newSystem.Windows.Forms.Button();this.button2=newSystem.Windows.Forms.Button();this.SuspendLayout();////button1//this.button1.Location=newSystem.Drawing.Point(33,12);this.button1.Name="button1";this.button1.Size=newSystem.Drawing.Size(112,39);this.button1.TabIndex=0;this.button1.Text="调用.NETAPI完成鼠标光标隐藏";this.button1.Click+=newSystem.EventHandler(this.button1_Click);////button2//this.button2.Location=newSystem.Drawing.Point(33,76);this.button2.Name="button2";this.button2.Size=newSystem.Drawing.Size(112,40);this.button2.TabIndex=0;this.button2.Text="调用Win32API完成鼠标光标显示";this.button2.Click+=newSystem.EventHandler(this.button2_Click);////Form1//this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);this.ClientSize=newSystem.Drawing.Size(182,149);this.Controls.Add(this.button1);this.Controls.Add(this.button2);this.Name="Form1";this.Text="例程";this.ResumeLayout(false);}#endregion///<summary>///应用程序的主入口点。///</summary>[STAThread]staticvoidMain(){Application.Run(newForm1());}//Win32API鼠标光标控制定义语句[System.Runtime.InteropServices.DllImport("user32.dll")]privatestaticexternintShowCursor(boolbShow);privatevoidbutton1_Click(objectsender,System.EventArgse){System.Windows.Forms.Cursor.Hide();//.netAPI隐藏鼠标光标}privatevoidbutton2_Click(objectsender,System.EventArgse){//ShowCursor(false);//Win32API隐藏鼠标光标ShowCursor(true);//Win32API显示鼠标光标}}}
解决方案
解决方案二:
没见过其他方法
解决方案三:
把所有API集成到几个接口中,做成COM,然后调用比较疯狂的说。。。。
解决方案四:
支持搂主,收藏
解决方案五:
引用2楼lake_cx的回复:
把所有API集成到几个接口中,做成COM,然后调用比较疯狂的说。。。。
我狂顶这个
解决方案六:
关注接分
解决方案七:
该回复于2008-05-09 11:13:29被版主删除