How to retrieve binary RC_DATA from a resource?

Joe
Sat Aug 30 22:37:25 PDT 2008


The following incomplete code example may help.
I believe GetResource is the key.  This example
uses a string; but I have stored small EXE programs
as a resource and retrieved the information the same way.
(i.e.
exebytes = GetResource(ID_TESTCFGEXE, RT_RCDATA, _
  &exeSize)
 OPEN ("TESTCFG.EXE") FOR BINARY NEW AS tempFP
   PUT$ tempFP, exebytes, exeSize '
   CLOSE tempFP              '
   RUN "TESTCFG.EXE " & BCX_ClassName$, SW_HIDE 
)
I hope this helps.

'-----------------code start
 $BCX_RESOURCE
// PORC must see header file to see ID_ defines
#include "include\test.h" 
 ID_TESTDATA RCDATA "include\\test.dat"   $BCX_RESOURCE


SUB RESTEXT_Setup()
  LOCAL testdata AS LPSTR
  LOCAL testdataSIZE as ULONG
  SendMessage(RESTEXT, WM_SETFONT, CreateFont(-21, 0, 0, 0, 400, 0, 
0, 0, 0, 3, 2, 1, 34, "Tahoma"),0) '16
	'
  testdata= (LPSTR)GetResource(ID_TESTDATA, RT_RCDATA, &testdataSIZE)
	'
	IF testdata = NULL then MSGBOX "ERROR"
	SetWindowText(RESTEXT, testdata)
END SUB 'RESTEXT_Setup

'----------end code


--- In BCX at yahoogroups.com, "Frank La Fontaine" <fandjlaf at ...> wrote:
>
> How to extract binary data from a resource in an .exe program and 
store 
> this in an array? I've extracted binary information before using 
> BCX_LOADIMAGE & PLAYWAV, but have had no success directing this to 
a 
> named memory location as specified by my BCX program.  Perhaps 
someone 
> has a short BCX example?
> 
> Thanks,
>         Frank
>



           



More information about the BCX mailing list