P/Invoke能够在asp.net中使用
点击次数:18 次 发布日期:2008-11-26 12:50:35 作者:源代码网
|
源代码网推荐 2 源代码网推荐 3using System; 源代码网推荐 4using System.Collections; 源代码网推荐 5using System.ComponentModel; 源代码网推荐 6using System.Data; 源代码网推荐 7using System.Drawing; 源代码网推荐 8using System.Web; 源代码网推荐 9using System.Web.SessionState; 源代码网推荐 10using System.Web.UI; 源代码网推荐 11using System.Web.UI.WebControls; 源代码网推荐 12using System.Web.UI.HtmlControls; 源代码网推荐 13 源代码网推荐 14using System.Runtime.InteropServices; 源代码网推荐 15using System.Windows.Forms; 源代码网推荐 16 源代码网推荐 17namespace Test_MyService 源代码网推荐 18{ 源代码网推荐 19 /**//// <summary> 源代码网推荐 20 /// WebForm1 的摘要说明。 源代码网推荐 21 /// </summary> 源代码网推荐 22 public class WebForm1 : System.Web.UI.Page 源代码网推荐 23 { 源代码网推荐 24 protected System.Web.UI.WebControls.TextBox TextBox1; 源代码网推荐 25 protected System.Web.UI.WebControls.Label Label1; 源代码网推荐 26 protected System.Web.UI.WebControls.Button Button1; 源代码网推荐 27 protected System.Web.UI.WebControls.TextBox TextBox2; 源代码网推荐 28 protected System.Web.UI.WebControls.TextBox txtQ; 源代码网推荐 29 protected System.Web.UI.WebControls.TextBox txtD; 源代码网推荐 30 源代码网推荐 31 localhost.ServiceTest myservice = new Test_MyService.localhost.ServiceTest(); 源代码网推荐 32 源代码网推荐 33 private void Page_Load(object sender, System.EventArgs e) 源代码网推荐 34 { 源代码网推荐 35 // 在此处放置用户代码以初始化页面 源代码网推荐 36 源代码网推荐 37 } 源代码网推荐 38 源代码网推荐 39 [DllImport("user32.dll", CharSet=CharSet.Ansi)] 源代码网推荐 40 public static extern int MessageBox(int h, string m, 源代码网推荐 41 string c, int type); 源代码网推荐 42 源代码网推荐 43 [DllImport("user32.dll", CharSet=CharSet.Ansi)] 源代码网推荐 44 public static extern Boolean MessageBeep(UInt32 beepType); 源代码网推荐 45 源代码网推荐 46 [DllImport("Kernel32.dll", SetLastError=true)] 源代码网推荐 47 static extern Boolean Beep(UInt32 frequency, UInt32 duration); 源代码网推荐 48 源代码网推荐 49 源代码网推荐 50 Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码 源代码网推荐 51 override protected void OnInit(EventArgs e) 源代码网推荐 52 { 源代码网推荐 53 // 源代码网推荐 54 // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 源代码网推荐 55 // 源代码网推荐 56 InitializeComponent(); 源代码网推荐 57 base.OnInit(e); 源代码网推荐 58 } 源代码网推荐 59 源代码网推荐 60 /**//// <summary> 源代码网推荐 61 /// 设计器支持所需的方法 - 不要使用代码编辑器修改 源代码网推荐 62 /// 此方法的内容。 源代码网推荐 63 /// </summary> 源代码网推荐 64 private void InitializeComponent() 源代码网推荐 65 { 源代码网推荐 66 this.Button1.Click += new System.EventHandler(this.Button1_Click); 源代码网推荐 67 this.Load += new System.EventHandler(this.Page_Load); 源代码网推荐 68 源代码网推荐 69 } 源代码网推荐 70 #endregion 源代码网推荐 71 源代码网推荐 72 private void Button1_Click(object sender, System.EventArgs e) 源代码网推荐 73 { 源代码网推荐 74 this.TextBox2.Text = myservice.Who(this.TextBox1.Text); 源代码网推荐 75 源代码网推荐 76// string pText = "Hello World!"; 源代码网推荐 77// string pCaption = "PInvoke Test"; 源代码网推荐 78// MessageBox(0, pText, pCaption, 0); 源代码网推荐 79 源代码网推荐 80 //MessageBeep(0x00000010); 源代码网推荐 81 Beep(Convert.ToUInt32(txtQ.Text),Convert.ToUInt32(txtD.Text)); 源代码网推荐 82 源代码网推荐 83 } 源代码网推荐 84 } 源代码网推荐 85} 源代码网推荐 86 其中MessageBox.Show(...)执行时就不动了,内部机理也不名所以,若是能够SHOW的话,那岂不是不用ACTIVEX了吗,一己之见而已了。根据理论是不行的,在。NET3.0(WinFX)可以将Win&Web集成到一起,那时将不分什么了,太恐怖了。 源代码网推荐 源代码网推荐 源代码网推荐 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。 源代码网推荐 源代码网供稿. |
