zoukankan      html  css  js  c++  java
  • c# 显示文件属性的代码

    internal static void ShowFileProperties(string path)
            {
                Shellexecuteinfo info = new Shellexecuteinfo();
                info.cbSize = Marshal.SizeOf(info);
                info.lpVerb = "properties";
                info.lpFile = path;
                info.nShow = 5;
                info.fMask = 12;
                ShellExecuteEx(ref info);
            }
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
            private struct Shellexecuteinfo
            {
                public int cbSize;
                public uint fMask;
                private readonly IntPtr hwnd;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpVerb;
                [MarshalAs(UnmanagedType.LPTStr)]
                public string lpFile;
                [MarshalAs(UnmanagedType.LPTStr)]
                private readonly string lpParameters;
                [MarshalAs(UnmanagedType.LPTStr)]
                private readonly string lpDirectory;
                public int nShow;
                private readonly IntPtr hInstApp;
                private readonly IntPtr lpIDList;
                [MarshalAs(UnmanagedType.LPTStr)]
                private readonly string lpClass;
    
                private readonly IntPtr hkeyClass;
                private readonly uint dwHotKey;
                private readonly IntPtr hIcon;
                private readonly IntPtr hProcess;
            }
    
    
            [DllImport("shell32.dll", CharSet = CharSet.Auto)]
            private static extern bool ShellExecuteEx(ref Shellexecuteinfo lpExecInfo);
    

      

  • 相关阅读:
    jdbc在项目中的应用
    第五次作业-springmvc对表单的获取
    jquery的文档处理(部分)
    测试报告怎么写合理
    WebService的简单应用
    hdu--5078--orz
    hdu--5074--dp
    hdu--5108--数论
    hdu--5072--容斥原理
    hdu--3853--概率dp
  • 原文地址:https://www.cnblogs.com/wujiangling/p/14107057.html
Copyright © 2011-2022 走看看