精易论坛

标题: 自定义数据类型OPENFILENAME [打印本页]

作者: wuyeliupiao    时间: 2021-7-13 15:41
标题: 自定义数据类型OPENFILENAME
自定义数据类型OPENFILENAME的成员文件扩展名的数据类型不应该是文本型吗

VX图片_20210713154015.png (18.85 KB, 下载次数: 0)

VX图片_20210713154015.png

作者: 1185384801    时间: 2021-7-13 15:48
MSDN中这2个参数的定义都是“WORD”
作者: 雨落无声    时间: 2021-7-13 16:41
  1. nFileExtension

  2. Type: WORD

  3. The zero-based offset, in characters, from the beginning of the path to the file name extension in the string pointed to by lpstrFile. For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters. Usually the file name extension is the substring which follows the last occurrence of the dot (".") character. For example, txt is the extension of the filename readme.txt, html the extension of readme.txt.html. Therefore, if lpstrFile points to the string "c:\dir1\dir2\readme.txt", this member contains the value 20. If lpstrFile points to the string "c:\dir1\dir2\readme.txt.html", this member contains the value 24. If lpstrFile points to the string "c:\dir1\dir2\readme.txt.html.", this member contains the value 29. If lpstrFile points to a string that does not contain any "." character such as "c:\dir1\dir2\readme", this member contains zero.
复制代码


https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-openfilenamea


MSDN官方文档解释,这个是指向lpstrFile参数是偏移量!所以是短整数很正常....
作者: 1436880331    时间: 2021-9-14 14:23
我也遇到这个问题了




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4