欢迎来到天天文库
浏览记录
ID:22213059
大小:63.00 KB
页数:6页
时间:2018-10-27
《使用c#在应用程序之间发送消息》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、使用C#在应用程序之间发送消息首先建立两个C#应用程序项目。 第一个项目包含一个odel; usingSystem.odel.Containerponents=null; [STAThread] staticvoidMain(){ Application.Run(ne1()); } publicForm1() { Initializeponent(); } protectedoverridevoidDispose(booldisposing) { if(disposing) { if(ponents!=null) { p
2、onents.Dispose(); } } base.Dispose(disposing); } #regionessageBox.Sho的代码如下: usingSystem; usingSystem.Text; usingSystem.Dra.Collections; usingSystem.ponentModel; usingSystem.odel.Containerponents=null; [STAThread] staticvoidMain(){ Application.Run(ne1()); } publicTest
3、Form1() { Initializeponent(); } protectedoverridevoidDispose(booldisposing) { if(disposing) { if(ponents!=null) { ponents.Dispose(); } } base.Dispose(disposing); } #region_CLICK=0x00F5; Messagemsg=Message.Create(hsg.Hsg,msg._CHAR=0x0102; IntPtrhs10.essage.Create(
4、hsg.Hsg,msg.essage(IntPtrh,IntPtrlParam); } 以上代码可以在VS.中编译运行,也可以使用csc.exe编译,如使用一下命令行: F:>csc.exeForm1.cs F:>csc.exeTestForm1.cs 编译后生成两个.exe文件。 首先运行第一个程序,显示Form1窗体,然后运行第二个程序,显示TestForm1窗体。 在TestForm1窗体上点击button1按钮(向Form1窗体上的button1发送消息)此时显示对话框提示“Thisisbutton1click!”。
5、在TestForm1窗体上点击button2按钮(向Form1窗体上的textBox1发送消息)此时在Form1上的textBox1上显示“测试aaa”。首先建立两个C#应用程序项目。 第一个项目包含一个odel; usingSystem.odel.Containerponents=null; [STAThread] staticvoidMain(){ Application.Run(ne1()); } publicForm1() { Initializeponent(); } protectedoverridevoidDispose(bool
6、disposing) { if(disposing) { if(ponents!=null) { ponents.Dispose(); } } base.Dispose(disposing); } #regionWindo.Windos.Button(); this.textBox1=ne.Windos.TextBox(); this.SuspendLayout(); // //button1 // this.button1.Location=ne.Drae=button1; this.button1.TabI
7、ndex=0; this.button1.Text=button1; this.button1.Click=ne.EventHandler(this.button1_Click); // //textBox1
此文档下载收益归作者所有