注意引用using System.Diagnostics;

解决方案 »

  1.   

    using System;
    using System.Diagnostics;
    using System.ComponentModel;namespace MyProcessSample
    {
        /// <summary>
        /// Shell for the sample.
        /// </summary>
        public class MyProcess
        {
            // These are the Win32 error code for file not found or access denied.
            const int ERROR_FILE_NOT_FOUND =2;
            const int ERROR_ACCESS_DENIED = 5;        /// <summary>
            /// Prints a file with a .doc extension.
            /// </summary>
            public void PrintDoc()
            {
                Process myProcess = new Process();
                
                try
                {
                    // Get the path that stores user documents.
                    string myDocumentsPath = 
                        Environment.GetFolderPath(Environment.SpecialFolder.Personal);                myProcess.StartInfo.FileName = myDocumentsPath + "\\MyFile.doc"; 
                    myProcess.StartInfo.Verb = "Print";
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.Start();
                }
                catch (Win32Exception e)
                {
                    if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
                    {
                        Console.WriteLine(e.Message + ". Check the path.");
                    }                 else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
                    {
                        // Note that if your word processor might generate exceptions
                        // such as this, which are handled first.
                        Console.WriteLine(e.Message + 
                            ". You do not have permission to print this file.");
                    }
                }
            }
            public static void Main()
            {
                MyProcess myProcess = new MyProcess();
                myProcess.PrintDoc();
            }
        }
    }
    也可以直接的Process.Start("c:\\qq.exe");
      

  2.   

    我的这段程序怎么注册不了,错在哪里了? private void bbReg_Click(object sender, System.EventArgs e)
    {
    Process p = new Process();
    p.StartInfo.FileName =  @"RegSvr32.exe";
    p.StartInfo.Arguments = @"/s c:\厦门万商盛世网络有限公司\ZWBAR.dll";
    p.Start();
    p.Close();
    }
      

  3.   

    是的,数字标签技术可以实现在DELPHI,VB等,在C# WEB里怎么实现呀?
      

  4.   

    System.Diagnostics.Process.Start("E:\\soft\\MYIE2\\MyIE.exe","www.yahoo.com.cn");
      

  5.   

    以下是对activex控件的数字签名(转自 stoway({有问题请发短消息给我}) 的回复):
    1. 下载数字签名工具
    在m$的网站上下载:codesigningx86.exe 文件。解压缩2. 使用VB的打包向导将主要使用的dll,ocx 文件等打包为 .cab 文件。
    3. 使用说明首先去MS的网站上下载CODESIGN.EXEP这个文件,这是个自解压文件,然后按以下示例做。
    工具包包括以下几个软件:
    makecert.exe  制作cer格式的证书,即X.509证书,同时可以创建私钥
    cert2spc.exe  将cer格式证书转换成spc格式证书,即PKCS #7证书
    signcode.exe  将证书签署到ocx上去
    chktrust.exe  检查签署证书后的ocx是否正确
    还有一个certmgr.exe,是管理证书用的。可以从这里面导出root.cer来,
    网上很多文章写到这个证书,但是在VC的安装盘中却找不到。其实,没
    有也没关系的。这几个软件可以从VC的安装盘中找到。下面是具体的步骤:
    1、创建一个自己的证书文件:
    makecert /sv "Record.PVK" /n "CN=XX有限公司" dream.cer
    这里,Record.PVK表示新创建的私人密钥保存文件名
        DreamCaptial是你想显示的公司名
         dream.cer是你创建最后的证书文件名
    这些根据你自己的要求填写,最后得到Record.PVK和dream.cer两个文件。
    其中,运行过程中需要输入私人密钥的保护密码,一定要输入一致,不要出错。2、转换cer格式为spc格式(可以省略)
    cert2spc dream.cer dream.spc
    得到dream.spc文件。3、给ocx进行签名
    运行signcode,命令行的我没有试验通过,我是通过界面实现的。
    signcode运行后会出现数字签名向导,首先选择你要签名的ocx,
    下一步后会出现签名选项,一种是典型,一种是自定义。选择自定义,
    这样才能从文件选择证书,选择前面制作的dream.spc,再下一步是
    选择私钥文件,选择Record.PVK,输入私人密钥的保护密码,选择散
    列算法,一般用md5就可以了,下一步是选择其他证书,直接下一步,
    填写一下这个控件的声明,用户用ie浏览的时候,会弹出证书说明,
    再下一步是加盖时间戳,我不会,直接下一步就完成了。4、用chktrust检查是否正确
    chktrust -v RecordProj.ocx用下列批命令做证书 
    makecert -sv "denghan.pvk" -n "CN=KinSoft"  test.cer
    cert2spc test.cer test.spc
    ---------------------------------------------
    用下列命令给CAB文件签名
    signcode -spc test.spc -v denghan.pvk -n "这个是CAB数字签名" -t '添加时间戳http://timestamp.verisign.com/scripts/timstamp.dll rx80.cabrx80.CAB文件用rx80.inf的内容[version]
    signature="$CHICAGO$"
    AdvancedINF=2.0[Add.Code]
    test.dll=test.dll
    rx80.inf=rx80.inf[test.dll]
    file=rx80.cab
    RegisterServer=yes 
    clsid={7E0CDEE7-DC80-4F37-9410-790BB5E9270E}
    DestDir=10
    FileVersion=1,0,0,1[rx80.inf]
    file=rx80.cab把这个CAB文件放到你的服务器上,用下列代码说明你的codebase,就会自动下载了。
    <object classid="clsid:7E0CDEE7-DC80-4F37-9410-790BB5E9270E" codebase="http://yourHostURL/rx80.cab#version=1,0,0,1" width="800" height="191">
    ...
    4. 参考资料http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaxctrl/html/msdn_deplactx.asp
    http://www.verisign.com
      

  6.   

    http://www.cnblogs.com/lyzhong/articles/39613.aspx