Delphi EXPERT ToolServices.getCurrentFile 失败

发布于 2024-12-08 22:13:04 字数 103 浏览 2 评论 0原文

获取 Delphi XE Experts 中正在处理的当前文件的新方法是什么?

以前在 Delphi 5-7 中我们使用 ToolServices.getCurrentFile

What is a new way to get current file that is being worked on in Experts for Delphi XE

Previously in Delphi 5-7 we used ToolServices.getCurrentFile

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

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

发布评论

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

评论(2

像极了他 2024-12-15 22:13:04

也许已弃用的单元 ToolIntfExptIntf 等不再工作。您可以使用 IOTAModuleServices.CurrentModule 代替。这是一个简单的例子:

function GetCurrentEditorFileName: string;
var
  Module: IOTAModule;
  Editor: IOTAEditor;
begin
  Result := '';
  Module := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
  if Assigned(Module) then
  begin
    Editor := Module.CurrentEditor;
    if Assigned(Editor) then
      Result := Editor.FileName;
  end;
end;

Perhaps the deprecated units ToolIntf, ExptIntf etc. are no longer working. You can use IOTAModuleServices.CurrentModule instead. Here's a quick example:

function GetCurrentEditorFileName: string;
var
  Module: IOTAModule;
  Editor: IOTAEditor;
begin
  Result := '';
  Module := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
  if Assigned(Module) then
  begin
    Editor := Module.CurrentEditor;
    if Assigned(Editor) then
      Result := Editor.FileName;
  end;
end;
雨落星ぅ辰 2024-12-15 22:13:04

另一种方法是将“编辑器中的文件名”作为参数传递给您的工具。 $EDNAME

An alternate method is to pass the "name of file in the editor" to your tool as a parameter. $EDNAME

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