Member_2_99151
asked on
Error EResNotFound when using custom component at runtime
Hi All,
I have written a delphi component package.
One of its components uses resources that are loaded at runtime using the following:
Now, when I place this component on a form in another application, it works fine and the images display correctly.
When i try to run the app, I get EResNotFound when trying to load the resource!
I'm sure I am missing something obvious, but I cannot see it!
Any help would be appreciated.
Regards,
James
I have written a delphi component package.
One of its components uses resources that are loaded at runtime using the following:
. . .
xPNGImage := TPNGImage.Create;
xPNGImage.LoadFromResourceName(FindClassHInstance(Self.ClassType), 'MyResName');
img := TImage.Create(ParComp);
img.Picture.Bitmap.Assign(xPNGImage);
. . .
Now, when I place this component on a form in another application, it works fine and the images display correctly.
When i try to run the app, I get EResNotFound when trying to load the resource!
I'm sure I am missing something obvious, but I cannot see it!
Any help would be appreciated.
Regards,
James
ASKER
Thanks for the response.
I had HInstance in the orignal code, but had the same error.
I found an online resource that suggested changing this for FindClassHInstance(Self.Cl assType) but to no avail...
This code would work fine in the same project, but as it is in a component, it seems to fail. Interestingly, it works fine in the IDE at design time :-O
I had HInstance in the orignal code, but had the same error.
I found an online resource that suggested changing this for FindClassHInstance(Self.Cl
This code would work fine in the same project, but as it is in a component, it seems to fail. Interestingly, it works fine in the IDE at design time :-O
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, that seems to do the trick... :-)
Open in new window