I have used resource builder to add some (static) xml to a res file. This appears in the rc file as
LANGUAGE LANG_NEUTRAL, 0
XML_PRICER_REPORT 24
MOVEABLE PURE LOADONCALL DISCARDABLE
BEGIN
0x723C, 0x7065, 0x726F, 0x2074, 0x6D78, 0x6E6C, 0x3D73, 0x6822,
0x7474, 0x3 ...........
I am trying to access this in Delphi as follows :
tmpStream := TResourceStream.Create(HInstance, 'XML_PRICER_REPORT', 'XML');
try
tmpStream.Read(XmlResult, tmpStream.Size);
OutputDocument.loadXml(XmlResult);
finally
tmpStream.Free;
end;
Delphi complains that it cannot load the resource item XML_PRICER_REPORT.
Has anyone out there any experience of this?
Thanks
Adrian
Accessing XML resource from Delphi5
Just use
Please let me know if this helps.
Code: Select all
tmpStream := TResourceStream.Create(HInstance, 'XML_PRICER_REPORT', 24);
Best regards,
Igor Siticov.
Igor Siticov.
Or and most important thing is that MS Windows doesn't always allow to use RT_XML (24) type resources in executable except manifests. So it may fail to load your application. So I would suggest to use something as custom resource type, say XML_TYPE and load it using:
So resource script will look like:
To be able to edit it still as text you can use View-> View as Text menu in Resource Builder.
Code: Select all
tmpStream := TResourceStream.Create(HInstance, 'XML_PRICER_REPORT', 'XML_TYPE');
Code: Select all
XML_PRICER_REPORT XML_TYPE
Best regards,
Igor Siticov.
Igor Siticov.