如何使用 Delphi 2009 和 Unicode 字符串正确调用 GetLongPathName?
我需要将旧的Win98短路径名更改为长路径名。我有一个在 Delphi 4 中运行良好的例程,但是当我升级到 Delphi 2009 和 Unicode 时,它无法与 Unicode 字符串一起运行。
我环顾四周,找不到它的 Unicode 兼容版本。
正确的例程似乎是 GetLongPathName from the WinAPI。但它似乎不在Delphi 2009的SysUtils库中,我一直无法弄清楚如何正确声明它以访问WinAPI例程。
另外,看起来确实很难打电话,因为我已经阅读了SO问题: Delphi TPath.GetTempPath 结果被裁剪,但这并没有帮助我到达一垒。
有人可以解释一下如何声明这个函数并在 Delphi 2009 中正确使用它传递 Unicode 字符串吗?
I need to change the old Win98 short path names to long path names. I had a routine that worked fine with Delphi 4, but when I upgraded to Delphi 2009 and Unicode, it didn't work with Unicode strings.
I looked around and couldn't find a Unicode-compatible version of it.
It appears that the correct routine to use is GetLongPathName from the WinAPI. But it doesn't seem to be in the SysUtils library of Delphi 2009 and I have not been able to figure out how to declare it properly to access the WinAPI routine.
Also, it does seem that it may be tricky to call, because I've read the SO Question: Delphi TPath.GetTempPath result is cropped but that didn't help me get to first base.
Can someone please explain how to declare this function and use it properly passing a Unicode string in Delphi 2009?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。您不需要单独的单元,并且可以在任何地方声明 GetLongPathName:
Sure. You do need not a separate unit and can declare GetLongPathName anywhere: