|
4#
楼主 |
发表于 2014-3-8 06:37:01
|
只看该作者
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
namespace WordAddIn1
{
public partial class Ribbon1
{
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
System.Diagnostics.Process Proc;
try
{
//启动记事本
Proc = new System.Diagnostics.Process();
Proc.StartInfo.FileName = "notepad.exe";
Proc.StartInfo.UseShellExecute = false;
Proc.StartInfo.RedirectStandardInput = true;
Proc.StartInfo.RedirectStandardOutput = false;
//隐藏记事本
Proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
//-------分割线----------
Proc.Start();
}
catch
{
Proc = null;
}
if (Proc != null) ;
{
//调用API,传递数据.之后不会写,也不是本课作业要求,嘿嘿留着以后写。
while (Proc.MainWindowHandle == IntPtr.Zero)
{
}
}
}
private void checkBox1_Click(object sender, RibbonControlEventArgs e)
{
if(checkBox1.Checked)
{
try
{
//打开网页版YY
System.Diagnostics.Process.Start("http://yy.com/91283328/2175343697?from=");
}
catch
{
//打开YY软件
System.Diagnostics.Process.Start("yy://pd-[sid=91283328&subid=2175343697]");
}
}
else
{
System.Diagnostics.Process.Start("http://user.qzone.qq.com/783780789/infocenter?ptsig=-W*xy2HazbDjecgKm6LD*bHXadJNfzYLDJYxHt9u9uw_");
}
}
}
}
|
|