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);
    

      

  • 相关阅读:
    is as运算符
    继承,多态
    封装等
    面向对象
    在JDBC中使用带参数的SQL语句
    我的程序库:HiCSDB
    我的程序库:HiCSUtil
    Java中,将ResultSet映射为对象和队列及其他辅助函数
    Java版的对象关系映射实现
    Java中的基本数据类型转换
  • 原文地址:https://www.cnblogs.com/wujiangling/p/14107057.html
Copyright © 2011-2022 走看看