
------------------
Henning
DIM L1 AS LONG DIM L2 AS LONG DIM SBuffer AS STRING DIM D1 AS DWORD ' L1 = FindResource(hInst, BYVAL %ID, BYVAL %RT_RCDATA 'If you NAMED your resource, use the name instead of BYVAL %ID: L1 = FindResource(hInst, "MYDATA", BYVAL %RT_RCDATA 'If you use an integer identifier, put the numebr in place 'of %ID L1 = FindResource(hInst, BYVAL 101, BYVAL %RT_RCDATA) IF L1 = %NULL THEN ERROR 101 L2 = LoadResource(hInst, L1) IF L2 = %NULL THEN ERROR 102 D1 = LockResource(L2) IF D1 = %NULL THEN ERROR 103 SBuffer = PEEK$(D1, 11111) 'Replace 11111 with the actual size of the resource (the size of 'of the file stored as the resource) 'Note that hInst is the Instance of the process owning the 'resource. I don't know if this method would work with 'LoadLibrary/FreeLibrary 'Once you've read the resource into the string variable (in this 'case, SBuffer), you may then use it in whichever way you 'require for your program 'I use this method to create autoextracting, autoinstalling 'EXE's to distribute my custom DLL's that my Public Release 'programs use [img]http://www.powerbasic.com/support/forums/smile.gif[/img] 'LockResource returns the address of the actual memory 'location where the resource is stored 'Note that you do NOT have to Unlock the resource in 32-bit 'Windows, according to Win32.hlp
DataAddr = LOADRESOURCE(BYVAL 0,BYVAL FINDRESOURCE(BYVAL 0&,_ "REGINFO",BYVAL %RT_RCDATA)) DIM I AS LONG FOR I=1 TO %DataCount DataItem = @DataAddr[i-1] + DataAddr:MSGBOX @DataItem NEXT
mydata rcdata "textfile.txt"
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: