zoukankan      html  css  js  c++  java
  • c# 调用 ShellExecute

    using System.Runtime.InteropServices;

    namespace ConsoleTest
    {
        class Program
        {
            public enum ShowCommands : int
            {
                SW_HIDE = 0,
                SW_SHOWNORMAL = 1,
                SW_NORMAL = 1,
                SW_SHOWMINIMIZED = 2,
                SW_SHOWMAXIMIZED = 3,
                SW_MAXIMIZE = 3,
                SW_SHOWNOACTIVATE = 4,
                SW_SHOW = 5,
                SW_MINIMIZE = 6,
                SW_SHOWMINNOACTIVE = 7,
                SW_SHOWNA = 8,
                SW_RESTORE = 9,
                SW_SHOWDEFAULT = 10,
                SW_FORCEMINIMIZE = 11,
                SW_MAX = 11
            }
            [DllImport("shell32.dll")]
            static extern IntPtr ShellExecute(
                IntPtr hwnd,
                string lpOperation,
                string lpFile,
                string lpParameters,
                string lpDirectory,
                ShowCommands nShowCmd);
            static void Main(string[] args)
            {
                ShellExecute(IntPtr.Zero, "open", @"c: est.flv", "", "", ShowCommands.SW_SHOWNORMAL);
                System.Console.ReadKey();
            }
        }
    }
    c#打开文件可以直接用

    System.Diagnostics.Process.Start(@"c: est.flv"); 

  • 相关阅读:
    Goolge-Guava Concurrent中的Service
    Golang操作数据库
    HttpContext
    office 问题集
    C# 日志使用
    字符编解码的故事 字符集 GBK GB2312 GB18030 Unicode 的由来和区别
    TCP UDP 协议的选择
    WebService 学习总结
    WebService 学习过程
    Archery:开源漏洞评估和管理工具
  • 原文地址:https://www.cnblogs.com/zxtceq/p/5889578.html
Copyright © 2011-2022 走看看