在 WinXP SP3 的 NTFS 中添加运行时文件摘要选项卡数据

发布于 2024-09-12 02:20:35 字数 2290 浏览 8 评论 0原文

我已经放弃尝试找出这个问题的原因,但这是这个故事,希望你能给一个提示......

当我开发独特的应用程序时( http://code.google.com/p/sedev ),因此我需要对其进行润色。
我必须将文件摘要(我认为非常有用的信息)添加到应用程序创建的任何文件中,因此我决定使用 NTFS 兼容结构 编辑:发生问题的代码片段:

if (FileExists(BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
              - 1) + '.vkp') = True) then // add NTFS descriptive information to output file
        try
          SetFileSummaryInfo
            (PWideChar(BaseLocation + LeftStr(GetSSWData, Length
                  (GetSSWData) - 1) + '.vkp')); // in my testcase files full path is: C:\Documents and Settings\Kludge\Desktop\sedevrpg\SEDEV_RPG_O_710.vkp
          ShowMessagePos('Patch Created successfuly!' + #13#13 +
              'Please verify created data to www.se-developers.net.',
            ParamStr2X, ParamStr3Y);
          MessageBeep(0);
        except // exception handler does not even fire on exception ...
          on Exception do
          begin
            if (WarningChBx.Checked = True) then
              ShowMessagePos
                ('Unable to add Description to Output file (' +
                  BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
                    - 1) + '.vkp )', ParamStr2X, ParamStr3Y);
            MessageBeep(0);
          end;
        end

作者最终编辑:问题出在 SetFileSummaryInfo(PWideChar('')) 中,因为在 PWideChar 转换后,您得到的是 CHARACTER,而不是 Array字符(又名字符串)因此它不再是有效的路径!

这是主要教程: http://www.delphipages.com/articles/setting_file_summary_information-9228 .html
编辑:格式更好的教程位于此处

但是,问题是我无法让该死的 FileName 参数接受任何字符串...我有 EOleSysError 异常:“%1 找不到”无论如何。

错误操作数是:

OleCheck(StgOpenStorageEx(PWideChar(FileName),
 STGM_SHARE_EXCLUSIVE or STGM_READWRITE,
 STGFMT_ANY,
 0, nil,  nil, @IID_IPropertySetStorage, stg));

我不明白的是为什么它实际上需要 %1 MSDOS 文件名输入。
我没有从 CMD 启动应用程序,因此我非常怀疑它需要额外的文件路径参数...

我已经尝试了所有可能的 String 和 PString 转换,还尝试了各种参数传递方法...它只是不起作用...

任何帮助赞赏!

I have given up tryng to figure out the reason of this issue, but here is the story and hope you could give a tip...

As I develop unique app ( http://code.google.com/p/sedev ) and therefore I need to polish it.
I have to add File Summary ( very useful info in my opinion ) to any created files by the app, so I decided to go with NTFS compatible structure
edit: code snippet in which problem occurs:

if (FileExists(BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
              - 1) + '.vkp') = True) then // add NTFS descriptive information to output file
        try
          SetFileSummaryInfo
            (PWideChar(BaseLocation + LeftStr(GetSSWData, Length
                  (GetSSWData) - 1) + '.vkp')); // in my testcase files full path is: C:\Documents and Settings\Kludge\Desktop\sedevrpg\SEDEV_RPG_O_710.vkp
          ShowMessagePos('Patch Created successfuly!' + #13#13 +
              'Please verify created data to www.se-developers.net.',
            ParamStr2X, ParamStr3Y);
          MessageBeep(0);
        except // exception handler does not even fire on exception ...
          on Exception do
          begin
            if (WarningChBx.Checked = True) then
              ShowMessagePos
                ('Unable to add Description to Output file (' +
                  BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
                    - 1) + '.vkp )', ParamStr2X, ParamStr3Y);
            MessageBeep(0);
          end;
        end

final edit by author: Problem was in SetFileSummaryInfo(PWideChar('')) because after PWideChar conversion you got CHARACTER, not Array of Characters ( aka Strings ) therefore it is not valid path anymore!

Here is main tutorial: http://www.delphipages.com/articles/setting_file_summary_information-9228.html
edit: a better formatted tutorial is here.

BUT, the thing is that I just cannot get that damned FileName param to accept any string ... I have EOleSysError exception: "%1 cannot be found" no matter what.

Faulting operand is:

OleCheck(StgOpenStorageEx(PWideChar(FileName),
 STGM_SHARE_EXCLUSIVE or STGM_READWRITE,
 STGFMT_ANY,
 0, nil,  nil, @IID_IPropertySetStorage, stg));

What I do not understand is why it actually wants %1 MSDOS file name input.
I am not launching app from CMD therefore I highly doubt it needs additional param for File path ...

I have tried all possible String and PString conversions, also tried various param passing methods ... It just does not work ...

Any help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自控 2024-09-19 02:20:35

我只能通过指定无效的文件名来重现您的情况。确保在文件名中包含完整路径。

I can only reproduce your case by specifying an invalid filename. Make sure that you include the full path in your filename.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文