<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading resources in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Reading-resources/m-p/986004#M27131</link>
    <description>Uh... been there once... let me see... yes, I got it on my disk. Well, the problem is that constant RT_RCDATA doesn't actually mean "any user-defined resource". The docs are rather unclear on that. Now, I don't recall the details about what the gotcha was, but the point is that you should "define" your resource type using an arbitrary ID (as with any control), store it to .rc file and use &lt;B&gt;that&lt;/B&gt; ID instead of RT_RCDATA.  &lt;BR /&gt; &lt;BR /&gt;Here's the copy &amp;amp; paste of a simple app which &lt;I&gt;stores its own source&lt;/I&gt; (ResExtract.f90) as a resource. It's a win32 app, though the principle is the same for any kind of application.  Note that USERTYPE is a PARAMETER of arbitrary value (10); it's added to resource.h and resource.fd manually: &lt;BR /&gt;&lt;PRE&gt; 
INTEGER FUNCTION WinMain(hInst, hPrevInst, lpCmdLine, nCmdShow) 
!DEC$ATTRIBUTES STDCALL, ALIAS: "_WinMain@16"::  WinMain 
USE DFWIN 
 
IMPLICIT NONE 
 
INCLUDE "Resource.fd" 
 
INTEGER:: hInst, hPrevInst, lpCmdLine, nCmdShow 
 
INTEGER:: hLGlobal, hResource, dwResourceSize, iSt 
!String buffer to retrieve the resource (this code) 
CHARACTER(LEN=1000)::  sVoidData; POINTER(lpVoidData, sVoidData) 
 
!Obtain resource's handle: 
hResource = FindResource(NULL, MAKEINTRESOURCE(Resource0001), MAKEINTRESOURCE(USERTYPE)); 
dwResourceSize = SizeOfResource(NULL, hResource); 
iSt=GetLastError() 
!Load resource into memory: 
hlGlobal = LoadResource(NULL, hResource); 
!Obtain a pointer from a memory handle and use it as  
lpVoidData = LockResource(hlGlobal); 
 
WinMain=1 
 
END FUNCTION WinMain  
!=8&amp;lt;=ResExtract.rc====================== 
// RT_RCDATA 
// 
Resource0001     USERTYPE   "ResExtract.f90" 
!=8&amp;lt;=resource.h====================== 
#define     Resource0001     100 
#define     USERTYPE          10 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
    <pubDate>Thu, 07 Mar 2002 07:28:17 GMT</pubDate>
    <dc:creator>Jugoslav_Dujic</dc:creator>
    <dc:date>2002-03-07T07:28:17Z</dc:date>
    <item>
      <title>Reading resources</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-resources/m-p/986003#M27130</link>
      <description>I have managed to write a custom binary resource to a .exe file. &lt;BR /&gt;I want to access the resource when I run the program. &lt;BR /&gt;I have tried using FindResource(NULL, IDR_name, RT_RCDATA)  &lt;BR /&gt;but I get a 0 handle.  This also happens when I replace RT_RCDATA by &lt;BR /&gt;any 16 bit number. &lt;BR /&gt;What call should I use to access the resource?</description>
      <pubDate>Thu, 07 Mar 2002 02:02:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-resources/m-p/986003#M27130</guid>
      <dc:creator>alfredodell</dc:creator>
      <dc:date>2002-03-07T02:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reading resources</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-resources/m-p/986004#M27131</link>
      <description>Uh... been there once... let me see... yes, I got it on my disk. Well, the problem is that constant RT_RCDATA doesn't actually mean "any user-defined resource". The docs are rather unclear on that. Now, I don't recall the details about what the gotcha was, but the point is that you should "define" your resource type using an arbitrary ID (as with any control), store it to .rc file and use &lt;B&gt;that&lt;/B&gt; ID instead of RT_RCDATA.  &lt;BR /&gt; &lt;BR /&gt;Here's the copy &amp;amp; paste of a simple app which &lt;I&gt;stores its own source&lt;/I&gt; (ResExtract.f90) as a resource. It's a win32 app, though the principle is the same for any kind of application.  Note that USERTYPE is a PARAMETER of arbitrary value (10); it's added to resource.h and resource.fd manually: &lt;BR /&gt;&lt;PRE&gt; 
INTEGER FUNCTION WinMain(hInst, hPrevInst, lpCmdLine, nCmdShow) 
!DEC$ATTRIBUTES STDCALL, ALIAS: "_WinMain@16"::  WinMain 
USE DFWIN 
 
IMPLICIT NONE 
 
INCLUDE "Resource.fd" 
 
INTEGER:: hInst, hPrevInst, lpCmdLine, nCmdShow 
 
INTEGER:: hLGlobal, hResource, dwResourceSize, iSt 
!String buffer to retrieve the resource (this code) 
CHARACTER(LEN=1000)::  sVoidData; POINTER(lpVoidData, sVoidData) 
 
!Obtain resource's handle: 
hResource = FindResource(NULL, MAKEINTRESOURCE(Resource0001), MAKEINTRESOURCE(USERTYPE)); 
dwResourceSize = SizeOfResource(NULL, hResource); 
iSt=GetLastError() 
!Load resource into memory: 
hlGlobal = LoadResource(NULL, hResource); 
!Obtain a pointer from a memory handle and use it as  
lpVoidData = LockResource(hlGlobal); 
 
WinMain=1 
 
END FUNCTION WinMain  
!=8&amp;lt;=ResExtract.rc====================== 
// RT_RCDATA 
// 
Resource0001     USERTYPE   "ResExtract.f90" 
!=8&amp;lt;=resource.h====================== 
#define     Resource0001     100 
#define     USERTYPE          10 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
      <pubDate>Thu, 07 Mar 2002 07:28:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-resources/m-p/986004#M27131</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2002-03-07T07:28:17Z</dc:date>
    </item>
  </channel>
</rss>

