文件扩展名,问题!。高分!

qiaoxing2000 2006-04-17 09:50:19
用的IShellFolder的GetDisplayNameOf的到文件的名称。但在windows,文件设置里,设置为
隐藏已知文件的扩展名。用GetDisplayNameOf就得到是没有扩展名的文件。在这个设置下,怎么才能得到文件全名?谢谢!急!!!!!!!!!!!!!!!!!!!!
...全文
183 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
菜牛 2006-04-17
  • 打赏
  • 举报
回复
Example

The following tables illustrate an example of possible return values for five different flag options and three different item types.

These are the flag options.

Number Flags Description
1 SHGDN_NORMAL | SHGDN_FORPARSING Returns the fully qualified parsing name.
2 SHGDN_INFOLDER | SHGDN_FORPARSING Returns the parsing name relative to the parent folder.
3 SHGDN_INFOLDER | SHGDN_FOREDITING Returns the editing name relative to the parent folder.
4 SHGDN_INFOLDER Returns the display name relative to the parent folder.
5 SHGDN_NORMAL Returns the display name relative to the desktop.

These are the sample item types.

Letter Description
A The C: drive on the local computer, whose volume label is C_DRIVE.
B A printer named Laser on a computer called Mailroom.
C The file C:\Directory\File.txt (when file-name extensions are hidden).

The following table describes the display names as they would be returned.

A B C
1 C:\ \\Mailroom\Laser C:\Directory\File.txt
2 C:\ Laser File.txt
3 C_DRIVE Laser File
4 C_DRIVE (C:) Laser File
5 C_DRIVE (C:) Laser on Mailroom File

Remarks on examples

A3: The C: drive presents its volume name for editing, rather than the entire string "C_DRIVE (C:)".
B1-B5: The display name of the remote printer changes depending on whether it is being shown relative to its parent. When shown relative to its parent, it needs only its printer name, but when shown outside its parent, it shows both its printer name and its computer name.
C3: File.txt presents only its base name for editing instead of its full name.
puyinghua 2006-04-17
  • 打赏
  • 举报
回复
GetModuleFileName函数返回长文件名,否则,仅返回8.3格式的文件名。

函数原型:DWORD GetModuleFileName(HMODULE hModule,LPTSTR lpFilename, DWORD nsize);

参数:
hModule:指向模块的句柄,该模块的可执行文件名被请求,如果此参数为NULL,则函数GetModuleFileName返回用来创建调用进程的文件路径。
lpFilename:指向一个缓冲区的指针,该缓冲区被给定模块的路径和文件名填充。
nsize:指向一个缓冲区的字符长度,如果路径和名的长度超过此范围,则字符串被截断。

返回值:如果函数调用成功,返回值为复制到缓冲区的字符串的字符长度;否则,返回值为零。
备注:如果一个模块被装载到两个进程,那么在一个进程中的模块文件与在与在另一个进程中的模块文件名不一样。
zhucde 2006-04-17
  • 打赏
  • 举报
回复
GetModuleFileName
qiaoxing2000 2006-04-17
  • 打赏
  • 举报
回复
shgdn_forparsing 是得到的物理路径
yajyjy 2006-04-17
  • 打赏
  • 举报
回复
应该可以得到,尝试修改uGlags试试
qiaoxing2000 2006-04-17
  • 打赏
  • 举报
回复
uFlags 没有2呀
shgdn_foraddressbar
shgdn_forparsing
shgdn_infolder
shgdn_normal
菜牛 2006-04-17
  • 打赏
  • 举报
回复
uFlags参数设置成2。
一条晚起的虫 2006-04-17
  • 打赏
  • 举报
回复
呵呵,IShellFolder强啊,以后也用用
一条晚起的虫 2006-04-17
  • 打赏
  • 举报
回复
http://vckbase.com/document/viewdoc/?id=940
一条晚起的虫 2006-04-17
  • 打赏
  • 举报
回复
IShellFolder没用过。
只用过FindFirstFile()和FindNextFind()。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧