|
|||
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius |
|
|||||||||||||
| Delphi Resource DLL problem - Usage - Three simple steps to localize - Technical Support (You need to be registered at the forum to write) - Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... | ||||||||||||||
| Author | Post | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
heaths Member
|
I am evalutaing Sisulizer v1.6.17, translating a test application written in Delphi 2006. The application has resourceStrings and a number of other resources linked in at compile time, bitmaps, wave files, rtf file. I have translated the resources and generated the resource dlls however the results are not as expected. I know the resource dll is being loaded because the translated resourceStrings appear as expected, but any of the other resources I load at run time come from the original executable, not the localized resource dll. resHacker confirms the translated resources are in the generated DLL (*.DE for example), but they are not loaded when I try for example: image1.BitmapChecked.LoadFromResourceName(hInstance, 'myBmp'); How do I get my application to load the resources from the localized resource DLL instead of the default resources embedded in the app, the strings just work but none of my other resources are loaded from the generated DLL. Just for interests sake I tried generating localized files and in this case it works as expected since the resources are replaced inside the executable, but how to make it work with resource dlls? Kind Regards, Heath Stephens
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
When you read data from resource you have to use LibModuleList.ResInstance instead of HInstance. HInstance always points to the main EXE. LibModuleList.ResInstance points to the active resource DLL. VCL has a build in mechanism for form and string data but all other data types you have to change HInstance to LibModuleList.ResInstance. procedure TForm1.Initialize; resourcestring SMsg = 'Powder skiing'; var image: TJpegImage; stream: TResourceStream; begin // You have to load the picture resource from active resource instance (if any) // instead of applications main instance (HInstance) if LibModuleList <> nil then stream := TResourceStream.Create(LibModuleList.ResInstance, 'Sample', 'IMAGE') else stream := TResourceStream.Create(HInstance, 'Sample', 'IMAGE'); image := TJpegImage.Create; try image.LoadFromStream(stream); Image1.Picture.Graphic := image; finally image.Free; stream.Free; end; Label1.Caption := SMsg; end; I have attached a Delphi sample that load JPEG data from resources. This sample will be in the next SL build as well. Jaakko Attachment: Image.zip (Downloaded 13 times)
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
heaths Member
|
Jakko, your solution works perfectly, thank you very much for you prompt help. Regards, Heath
|
|||||||||||||
| ||||||||||||||
| Current time is 10:05 pm | |
| Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... > Technical Support (You need to be registered at the forum to write) > Usage - Three simple steps to localize > Delphi Resource DLL problem | |
Sisulizer software localization tool - Three simple steps to localize