Resource - EndResource

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Resource - EndResource

Post by GPI »

like datasection, but in windows the data will be stored in the resource-section of the execute. I don't know, how linux or mac handle this kind of information, but in worst case, simple handle resources like a datasection.
Labels are used for definied a resource name.

res=OpenResource(<id>,<label>)
Open a Resource, id can be a number or #pb_any, label identificate the resource

len=ResourceSize(<id>)
Return the size of the Resource in bytes

*mem=Resource(<id>)
Return the memory address of the resource

CloseResource(<id>)
close the resource.

Example:

Code: Select all

Resource
  XML_About:
     IncludeBinary "xml\about_dialog.xml"
  XML_Main:
     IncludeBinary "xml\main_dialog.xml"
  Img_Logo:
     IncludeBinary "img\Logo.png"
EndResource

res=OpenResource(#pb_any, XML_About)
xml=CatchXML(#pb_any,Resource(res),ResourceSize(res))
FreeResource(res)