Ejemplo n.º 1
0
    public static string SaveFilePath(string filter, string title, string extension)
    {
        FIleDialogStruct pth = new FIleDialogStruct();

        pth.structSize   = System.Runtime.InteropServices.Marshal.SizeOf(pth);
        pth.filter       = filter;
        pth.file         = new string(new char[256]);
        pth.maxFile      = pth.file.Length;
        pth.fileTitle    = new string(new char[64]);
        pth.maxFileTitle = pth.fileTitle.Length;
        pth.initialDir   = Application.dataPath; // default path
        pth.title        = title;
        pth.defExt       = extension;
        pth.flags        = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        if (FIleDialogStruct.GetSaveFileName(pth))
        {
            return(pth.file);//选择的文件路径;
        }
        else
        {
            return(null);
        }
    }
Ejemplo n.º 2
0
 public static extern bool GetSaveFileName([In, Out] FIleDialogStruct ofd);
Ejemplo n.º 3
0
 public static extern bool GetOpenFileName([In, Out] FIleDialogStruct ofn);