Link to home
Start Free TrialLog in
Avatar of RipBucks
RipBucks

asked on

Delphi XE LoadFromResourceName resource not found

I have created a component inherited from an image button. I have added the up and down images to the resource image list using the 'Project|Resources and Images' menu option .
the bitmaps appear in the Project Manager and it all compiles an installs just fine.
When I use the button in my project there are no errors and the button image is used when viewed in the design window.
My project compiles just fine but when I try to open the window when running the program it give an error:


User generated image
the create code for the button is:

constructor TSMfcImageBtn.create(aowner:tcomponent);
var
buttonup,buttondown : Tbitmap;
begin
inherited;
try
  buttonup := Tbitmap.Create;
  buttonup.LoadFromResourceName(hInstance,'ButtonUp');
  image.loadfrombitmap(buttonup);
  buttondown := Tbitmap.Create;
  buttondown.LoadFromResourceName(hInstance,'ButtonDown');
  imagedown.loadfrombitmap(buttondown);
finally
  buttonup.Free;
  buttondown.Free;
end;
offsets.GlyphX := 0;
offsets.GlyphY := 0;
offsets.ImageDownX := 0;
offsets.ImageDownY := 0;
offsets.TextDownX := 0;
offsets.TextDownY := 0;
offsets.TextX := 0;
offsets.Texty := 0;
end;


Any ideas
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RipBucks
RipBucks

ASKER

Thanks for the code but FindResource won't compile. I can find it in the help but it does not appear in my system unit. Nor does the program know what RT_Bitmap is.
So I can't test if this is a solution
Add Windows in uses.