http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

12
返回列表 发新帖
楼主: 冰忆

[其他] 怎么能让System.Diagnostics.Process.Start(savePath); 打开的播放器自动隐藏呢

[复制链接]
 楼主| 发表于 2013-10-14 17:32:21 | 显示全部楼层
站长苏飞 发表于 2013-10-14 17:23
用的那个方法怎么写的

        [DllImport("kernel32.dll")]
        public static extern int WinExec(string exeName, int operType);

        public static void openbp(string bpbh)
        {
            accessdata m_db = new accessdata();
            DataSet ds_file = m_db.getdataset("select Fjnr,fjlx from gl_bp where Bpbh='" + bpbh + "'");

            if (ds_file != null && ds_file.Tables[0].Rows.Count > 0)
            {
                Byte[] Files = (Byte[])ds_file.Tables[0].Rows[0]["Fjnr"];
                if (Files.Length > 0)
                {
                    string savePath = AppDomain.CurrentDomain.BaseDirectory;
                    savePath += "filetemporary" + ds_file.Tables[0].Rows[0]["fjlx"].ToString();

                    FileStream fs;
                    if (System.IO.File.Exists(savePath))
                    {
                        fs = new FileStream(savePath, FileMode.Truncate);
                    }
                    else
                    {
                        fs = new FileStream(savePath, FileMode.CreateNew);
                    }
                    BinaryWriter br = new BinaryWriter(fs);
                    br.Write(Files, 0, Files.Length);
                    br.Close();
                    fs.Close();

                    //System.Diagnostics.Process.Start(savePath);

                    //ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder(savePath), new StringBuilder(""), new StringBuilder(""), 0);
                    WinExec(savePath, 5);
                }
            }



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2013-10-14 17:34:48 | 显示全部楼层
站长苏飞 发表于 2013-10-14 17:23
用的那个方法怎么写的

WinExec应该是只能打开exe吧?我是MP4文件
 楼主| 发表于 2013-10-14 17:38:04 | 显示全部楼层
站长苏飞 发表于 2013-10-14 17:23
用的那个方法怎么写的

我之前写的
        [DllImport("shell32.dll")]
        public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilder lpszParams, StringBuilder lpszDir, int FsShowCmd);


        public static void openbp(string bpbh)
        {
            accessdata m_db = new accessdata();
            DataSet ds_file = m_db.getdataset("select Fjnr,fjlx from gl_bp where Bpbh='" + bpbh + "'");

            if (ds_file != null && ds_file.Tables[0].Rows.Count > 0)
            {
                Byte[] Files = (Byte[])ds_file.Tables[0].Rows[0]["Fjnr"];
                if (Files.Length > 0)
                {
                    string savePath = AppDomain.CurrentDomain.BaseDirectory;
                    savePath += "filetemporary" + ds_file.Tables[0].Rows[0]["fjlx"].ToString();

                    FileStream fs;
                    if (System.IO.File.Exists(savePath))
                    {
                        fs = new FileStream(savePath, FileMode.Truncate);
                    }
                    else
                    {
                        fs = new FileStream(savePath, FileMode.CreateNew);
                    }
                    BinaryWriter br = new BinaryWriter(fs);
                    br.Write(Files, 0, Files.Length);
                    br.Close();
                    fs.Close();

                    //System.Diagnostics.Process.Start(savePath);

                    ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder(savePath), new StringBuilder(""), new StringBuilder(""), 0);
                    //WinExec(savePath, 0);
                }
            }


能够打开,但是0应该是隐藏,
我打开的效果确实。直接弹出暴风影音。
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-4-29 07:11

© 2014-2021

快速回复 返回顶部 返回列表