想问一下windows api里面有没有可以获取文件操作(诸如打开,新建,删除,修改)信息的函数...该用哪些,在线等.

解决方案 »

  1.   

    随便baidu一下都有的吧
    [DllImport("kernel32")] public static extern int CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, ref SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, HANDLE hTemplateFile);
    [DllImport("kernel32")] public static extern int OpenFile(string lpFileName, ref OFSTRUCT lpReOpenBuff, int wStyle);
    [DllImport("kernel32")] public static extern int ReadFile(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToRead, ref int lpNumberOfBytesRead, ref OVERLAPPED lpOverlapped);
    [DllImport("kernel32")] public static extern int WriteFile(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToWrite, ref int lpNumberOfBytesWritten, ref OVERLAPPED lpOverlapped);
    [DllImport("kernel32")] public static extern int DeleteFile(string lpFileName);
    ...