Shortening Long Paths


Sometimes you might have seen that application which loads some files, showing its path in the title bar with its short form. we can do it simply by 2-3 lines of code.

Note the API are defined at shlwapi.h and we should link with shlwapi.lib
See the output


CString strEditText("C:\\test\\test\\test\\test\\test\\etst.xyz");
PathCompactPath(GetDC()->m_hDC,strEditText.GetBuffer(0),125);
strEditText.ReleaseBuffer();

Regards,
SaRath.
"Don't Do Different things… Do Things Differently…"

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

blog comments powered by Disqus