window路径操作API函数在C#中的调用

window路径操作API函数

在C#中调用PathRelativePathTo函数时

函数的作用是

创建一个路径到另一个路径的相对路径。

var relativePathBuilder = new StringBuilder(260);

[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
        private static extern bool PathRelativePathTo([Out] StringBuilder path,
            [In] string from, [In] FileAttributes fromAttributes,
            [In] string to, [In] FileAttributes toAttributes);

string to 是要被转换的路径

string from 是要参照转换的另一个路径

StringBuilder是to相对于from转换后的相对路径。

 

弄的不清楚,会继续更新

posted @ 2012-09-27 10:00  我心微凉  阅读(280)  评论(0编辑  收藏  举报