首页  编辑  

得到8.3短路径

Tags: /C#/文件目录操作/   Date Created:

[ DllImport ( "kernel32.dll" )]

public static extern uint GetShortPathName( string lpszLongPath ,

    StringBuilder lpszShortPath, int cchBuffer);

private void button1_Click( object sender , EventArgs e)

{

    StringBuilder vBuffer = new StringBuilder ( 260 );

   GetShortPathName( @"C:\Program Files\Common Files\ODBC\Data Sources" ,

       vBuffer, vBuffer . Capacity);

   Text = vBuffer . ToString();

}