如何诊断“无法访问包裹信息” Delphi IDE 中的错误

发布于 2024-07-26 05:36:15 字数 2389 浏览 11 评论 0原文

我正在开发一组基于 TFrame 的组件,这些组件相互继承(正如许多一路上为我提供巨大帮助的人已经知道的那样!),并且遇到了另一个小“障碍”,与软件包和安装相关。

我基本上有以下层次结构:

TFrame
  TBaseFRame
TBaseSizeableFrame
  TViewerType1
  TViewerType2

...和一个面板,TExtRzPanel,它继承自 Raize 面板,并向其添加一些大小调整/移动功能,以及一些其他属性/功能。 TBaseSizeableFrame 使用此组件,并将其大部分功能传递给框架本身,因此我可以直观地开发复合查看器组件。 总体来说效果很好。

TFrame 后代都已注册到调色板(请参阅 这篇文章是我之前问的相关问题)。 目前,我的包设置如下:

  • MyPanels - 包含 TExtRzPanel
  • BaseFrames - 包含 TBaseFrame 和 TBaseSizeableFrame
  • ViewerSet1 - 包含一个查看器框架 -基于组件,以及一个以对话框形式调用该查看器的非可视组件。 (我计划在这个包中也包含一些其他观众)。

引发我当前混乱的主要错误是这个:

无法访问包“MyPanels.bpl”的包信息

我现在对这件事感到头晕目眩,因为我无法记住确切的序列我已经尝试过什么以及按什么顺序,但是当我将对话框表单添加到 ViewerSet1 时,麻烦似乎已经开始了,它使用来自同一项目的 TViewer 框架,并且(当然)因此使用 TExtRzPanel (这是IDE 抱怨的包)。

基于这个我已经删除了 DCP 文件(我认为在某些时候也删除了 DCU 文件),卸载了软件包,然后重新编译/重新安装了它们 MyPanels -> BaseFrames,并使它们全部工作到这一点,但是在安装 ViewerSet1 后,整个事情再次崩溃。 我在尝试解决此问题的过程中注意到的其他错误包括:

  • Package C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl\MyPanels.bpl 无法安装,因为它是使用不同版本的 Delphi 或 CBuilder 创建。 您想在下次加载项目时尝试加载此包吗?(注意:我只使用一个版本的 Delphi - Delphi 2007 构建了此包)
  • 在某一时刻,我注意到包描述for MyPanels 没有“采取”(即它显示为文件名是 Tools -> Compoenent -> Install Packages),这让我认为也许该文件有两个版本IDE 正在查找/使用,但我没有看到/发现情况确实如此。
  • Delphi启动时给出的警告,提示无法加载已安装的包,下次是否要加载等等。
  • 无法访问包'MyPanels.bpl'的包信息(Lather ,冲洗,重复)

任何和所有关于如何诊断的帮助/指导,以及任何可以帮助我理解要寻找什么的概念解释,将是赞赏的。 提前致谢。 你们在这里非常有帮助! 谢谢。 :)


稍后更新:

将其放在一边并返回后,我尝试删除所有 DCP / DCU MyPanels 文件,然后逐步安装这三个软件包。 (VMWare 在这里是物有所值的——每次成功后的快照,以便在出现问题时不必从头开始)。 事实证明,如果我从 ViewerSet1 pakckage 中删除对话框表单,它就可以安装正常。 如果我再次添加表单(它不会显示其 DFM,就像我遇到 这里),看来安装OK了。 我已经安装了所有组件,并且看起来工作正常(并在我的虚拟机中拍摄了整个组件的快照!),但我仍然不确定出了什么问题,也不知道为什么。 添加该表单最初会执行什么操作,从而导致此类错误? 任何想法?

我认为,即使更好地解释/理解哪些事情会导致“无法访问包信息”错误,从长远来看也会有所帮助。

I am developing a set of TFrame-based components that inherit from one another (as so many who have helped me tremendously along the way already know!), and am running into yet another little "snag," related to packages and installation.

I have essentially the following hierarchy:

TFrame
  TBaseFRame
TBaseSizeableFrame
  TViewerType1
  TViewerType2

...and a panel, TExtRzPanel, which inherits from a Raize Panel and adds some sizing / moving functionality to it, along w/a few other properties / features. TBaseSizeableFrame uses this component, and passes through much of it's functionality to the frame itself, so I can develop the compound Viewer components visually. Overall it works well.

The TFrame descendants are all registered to the palette (see
this post for related question I asked earlier). Currently, I have packages set up like this:

  • MyPanels - Contains the TExtRzPanel
  • BaseFrames - Contains TBaseFrame, and TBaseSizeableFrame
  • ViewerSet1 - Contains one Viewer frame-based component, and a non-visual component which calls that Viewer as a dialog form. (I'm planning on this package having a few other viewers in it as well).

The main error that started my current chaos was this one:

Cannot access package information for package 'MyPanels.bpl'

I'm dizzy enough with this thing now that I'm having trouble remembnering the exact sequences of what I've tried and in what order, but the trouble seems to have started when I added the dialog form to ViewerSet1, which uses a TViewer frame from the same project, and which (of course) thus uses a TExtRzPanel (which is the package the IDE is complaining about).

Based on this I've deleted the DCP files (and DCU files too, I think at some point), uninstalled the packages, and then recompiled/reinstalled them MyPanels -> BaseFrames, and got them all working to that point, but upon installing ViewerSet1 the whole thing blows apart again.
Other errors I noted along the way of trying to figure this out include these:

  • Package C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl\MyPanels.bpl can't be installed because it was created with a different version of Delphi or CBuilder.
    Do you want to attempt to load this package the next time a project is loaded?
    (Note: I've only built this with ONE version of Delphi -- Delphi 2007)
  • At one point, I noticed that the package description for MyPanels didn't "take" (i.e. it showed up as just the file name is Tools -> Compoenent -> Install Packages), which makes me think maybe there are two versions of the file the IDE is finding / using, but I'm not seeing/finding that to be the case.
  • The warning Delphi gives when starting up, indicating it can't load an installed package, and do you want to load it next time, etc.
  • Cannot access package information for package 'MyPanels.bpl' (Lather, rinse, repeat)

Any and all help / direction re: how to diagnose, along with any conceptual explanation which could help me understand what to even look for, would be most appreciated. THANKS IN ADVANCE. You folks have been SO helpful here! Thank you. : )


Update later:

After setting this aside for a bit and coming back to it, I tried deleting all the DCP / DCU MyPanels files, and then installing the three packages step by step. (VMWare was worth its weight in gold here -- snapshots after each success, so as to not have to start over at the bottom if/when things went wrong). Turns out, if I removed the dialog form from the ViewerSet1 pakckage, it installs OK. If I then add the form again (which doesn't show up with its DFM, like I ran into
here
), it seems to install OK. I've got all the components installed not and seemingly working OK (and snapshot the whole thing in my VM!), but I'm still not sure what went wrong nor why. What could adding that form have done initially which would cause these kinds of errors? Any idea?

Even a better explanation / understanding of what kinds of things can cause the "Cannot access package information" error would be helpful in the long run, I think.

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

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

发布评论

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

评论(1

等风来 2024-08-02 05:36:15

好吧,我肯定缺少一些东西。 来自 SysUtils:

function PackageInfoTable(Module: HMODULE): PPackageInfoHeader;
var
  ResInfo: HRSRC;
  Data: THandle;
begin
  Result := nil;
  ResInfo := FindResource(Module, 'PACKAGEINFO', RT_RCDATA);
  if ResInfo <> 0 then
  begin
    Data := LoadResource(Module, ResInfo);
    if Data <> 0 then
    try
      Result := LockResource(Data);
      UnlockResource(Data);
    finally
      FreeResource(Data);
    end;
  end;
end;

因此,如果您收到最后一个错误,则说明您的包没有附加必要的 PACKAGEINFO 资源。 这可能也是您的第一个错误的原因(使用不同版本的 Delphi 创建)。

很抱歉问这个问题,但是您是通过选择“文件”->“新建”->“包”-Delphi 创建包的吗? 我问这个问题是因为它具有仅具有 bpl 扩展名的库的所有特征。

如果您确定该包是以正确的方式创建的,我建议您在整个硬盘驱动器中搜索同名的 DLL 文件。 对于您找到的所有 bpl 包,您应该执行以下命令:

C:\Program Files\CodeGear\RAD Studio\5.0\bin\tdump.exe mypackage.bpl>mypackage.txt

在您的 mypackage.txt 文件中应该有一个名为 PACKAGEINFO 的资源。

或者,您可以从 live.sysinternals.com 下载 filemon.exe,设置 bds 过滤器并监视 IDE 实际尝试加载的内容。 它很可能是您的包正在加载的另一个包,并且第二个包没有附加 PACKAGEINFO。

OK, there is definitely something that I'm missing. From SysUtils:

function PackageInfoTable(Module: HMODULE): PPackageInfoHeader;
var
  ResInfo: HRSRC;
  Data: THandle;
begin
  Result := nil;
  ResInfo := FindResource(Module, 'PACKAGEINFO', RT_RCDATA);
  if ResInfo <> 0 then
  begin
    Data := LoadResource(Module, ResInfo);
    if Data <> 0 then
    try
      Result := LockResource(Data);
      UnlockResource(Data);
    finally
      FreeResource(Data);
    end;
  end;
end;

So, if you are getting this last error, your package does not have the necessary PACKAGEINFO resource attached to it. This is probably also the cause of your first error (created with a different version of Delphi).

Appologies for asking this, but did you create the package by selecting File->New->Package-Delphi? I'm asking, because this have all the hallmarks of a library that simply has the bpl extention.

If you are certain that the package was created in the right way, may I suggest that you search your entire hard drive for a DLL file of the same name. And all the bpl packages that you do find, you should execute the following for:

C:\Program Files\CodeGear\RAD Studio\5.0\bin\tdump.exe mypackage.bpl>mypackage.txt

In your mypackage.txt file there should then be a resource called PACKAGEINFO.

Alternatively, you can download filemon.exe from live.sysinternals.com, set a bds filter and spy on what the IDE is actually trying to load. It could very well be another package that is being loaded by your package and that this second package does not have PACKAGEINFO attached.

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