views:

111

answers:

1

Hi dudes,

I'm using dynamic link to load (BPL) modules into my app, the loading works fine with simple forms built into those moudles, but when adding more and more (third-) components and code to one form I get this error message "Invalid class typecast" for tha first time, 'cause for the second time the loading works ok, so I caught that exception and I load that module again, well that's my workaround, but Why does it happen?

Thanks in advance.

+1  A: 

Sounds like the filename doesn't exist.

Marco van de Voort
Right!, after checking units used for PictureFrame form, I found that the problem is in WUtils unit, this unit was created by me and I use it in each app, it works fine but sets in modules raise an error, this error is raised by "RestoreIfRunning" function, which check if app is running to restore it, the code of this function can be found at: http://delphi.about.com/od/windowsshellapi/l/aa100703c.htmThis technique uses file mapping and in finalization section tries to close a file created raising this error. My question is now What to do to avoid it? Thanks anyway.
Billiardo Aragorn