0

我的应用程序(在 Delphi 7 上编写)在 Windows XP SP3 上正确运行,但是当我尝试在 Windows 7 上运行它时,会发生此异常:

带有消息“Invalid ImageList”的 EInvalidOperation

这是主要的应用程序代码:

  Application.Initialize;

  tmpSplash.GoNextMsg;
  Application.CreateForm(TdmImages, dmImages);

  tmpSplash.GoNextMsg; // Collegamento database
  Application.CreateForm(TdmCharter, dmCharter);


  tmpSplash.GoNextMsg; // Caricamento immagini
  Application.CreateForm(TfrMain, frMain);

  tmpSplash.GoNextMsg; // init: Anagrafica
  frameAnagrafica := TframeAnagrafica.Create(Application);

  tmpSplash.GoNextMsg; // init: Flotta
  frameFlotta := TframeFlotta.Create(Application);
  //Application.CreateForm(TframeFlotta, frameFlotta);

  ...
  ...

dmImages 模块已正确创建,例如 frMain,但是何时创建对象 frameAnagrafica 然后在构造函数方法上引发异常:

type
    TframeAnagrafica = class(TMyCustomFrame)
...
...

{$R *.dfm}
constructor TframeAnagrafica.Create(AOwner: TComponent);
begin
  inherited Create(AOwner); 

end;

还有 TframeAnagrafica 的“超类”:

TMyCustomFrame = class(TFrame)
...
...

{$R *.dfm}

constructor TMyCustomFrame.Create(AOwner: TComponent);
begin
  inherited Create(AOwner); <-- Exception here

end;

在windows XP 下没问题,但是使用windows 7 就出现问题了。我该如何解决这个问题?

4

2 回答 2

1

如果您使用ColorDepth当前操作系统不支持的属性值,则可能会发生此类异常。或者,如果您尝试使用带有 alpha 通道 ( TColorDepth.cd32Bit) 的 32 位图像列表,但您的应用程序中没有 XP 清单,则会发生这种情况。为此,请将该单元包含xpman在您的项目中,或在 Delphi XE2 或更高版本中的“项目 > 选项 > 应用程序 > 外观 > 运行时主题”中选择“启用运行时主题”。

于 2013-06-27T13:04:46.357 回答
0

I just received updates from windows 10 and it messed up my machine it took away permissions to my folders. I am currently running Delphi and when I was trying to print out reports I getting error message Class Elnvalidoperation can't generate report. It was because my printer disappeared and I had to reinstall and the issue seems to be fixed.

于 2017-06-23T17:04:21.573 回答