﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-八叶草(徐怀移)-随笔分类-Windows Shell</title><link>http://www.cppblog.com/byc/category/15587.html</link><description>学习资料记录</description><language>zh-cn</language><lastBuildDate>Thu, 03 May 2012 18:37:52 GMT</lastBuildDate><pubDate>Thu, 03 May 2012 18:37:52 GMT</pubDate><ttl>60</ttl><item><title>取 %appdata% %*% 路径</title><link>http://www.cppblog.com/byc/archive/2010/12/03/135353.html</link><dc:creator>八叶草</dc:creator><author>八叶草</author><pubDate>Fri, 03 Dec 2010 07:23:00 GMT</pubDate><guid>http://www.cppblog.com/byc/archive/2010/12/03/135353.html</guid><wfw:comment>http://www.cppblog.com/byc/comments/135353.html</wfw:comment><comments>http://www.cppblog.com/byc/archive/2010/12/03/135353.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/byc/comments/commentRss/135353.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/byc/services/trackbacks/135353.html</trackback:ping><description><![CDATA[SHGetSpecialFolderLocation<br />ExpandEnvironmentStrings <br /><br /><a href="http://blog.csdn.net/wvw/article/details/5471611">http://blog.csdn.net/wvw/article/details/5471611</a><br />
<p>用ExpandEnvironmentStrings 获取 %appdata%</p>
<p>正常情况下没问题, 但是当你的程序被外部程序启动时, 可能会产生获取错误的问题(非失败). 比如system给你启动.</p><br /><br /><br /><br /><a href="http://blog.sina.com.cn/s/blog_4e4fba0401000ah2.html">http://blog.sina.com.cn/s/blog_4e4fba0401000ah2.html</a><br />如何获取临时文件夹位置<br />&nbsp;<wbr>char&nbsp;<wbr>Path[MAX_PATH];<br />&nbsp;<wbr>CString&nbsp;<wbr>StrPath;<br />&nbsp;<wbr>LPITEMIDLIST&nbsp;<wbr>pidl;<br />&nbsp;<wbr>LPMALLOC&nbsp;<wbr>pShellMalloc;<br />&nbsp;<wbr>if(SUCCEEDED(SHGetMalloc(&amp;pShellMalloc)))<br />&nbsp;<wbr>if(SUCCEEDED(SHGetSpecialFolderLocati<wbr>on(NULL,CSIDL_TEMPLATES,&amp;pidl)))<br />&nbsp;<wbr>if(SHGetPathFromIDList(pidl,Path))<br />&nbsp;<wbr>{<br />&nbsp;<wbr>&nbsp;<wbr>StrPath.Format("%s",Path);<br />&nbsp;<wbr>&nbsp;<wbr>MessageBox("临时文件夹位于："+StrPath,"提示信息",MB_OK);<br />&nbsp;<wbr>}<br />&nbsp;<wbr>pShellMalloc-&gt;Free(pidl);<br />&nbsp;<wbr>pShellMalloc-&gt;Release(); <img src ="http://www.cppblog.com/byc/aggbug/135353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/byc/" target="_blank">八叶草</a> 2010-12-03 15:23 <a href="http://www.cppblog.com/byc/archive/2010/12/03/135353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>