Question

My application (write on Delphi 7)runs correctly on Windows XP SP3 but when I try to run it on Windows 7 this exception occurs:

EInvalidOperation with message "Invalid ImageList"

This is the main application code:

  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);

  ...
  ...

The module dmImages has been created correctly, such as the frMain, but when will created the object frameAnagrafica then raise the exception on the constructor method:

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

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

end;

And the "super-class" of TframeAnagrafica:

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

{$R *.dfm}

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

end;

In windows XP no problem, but using Windows 7 occurs the problem. How can I resolve this problem?

Was it helpful?

Solution

An exception like this can occur if you use a value for the property ColorDepth that is not supported by the current operating system. Or it can occur if you try to use a 32Bit imagelist with alpha channel (TColorDepth.cd32Bit) but do not have an XP manifest in you application. To do so, include the unit xpman in your project or choose "Enable runtime themes" at "Project > Options > Application > Appearance > Runtime themes" ind Delphi XE2 or higher.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top