Results 1 to 8 of 8

Thread: PNG -> RES

  1. #1
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    PNG -> RES

    How do I put a PNG image into a Resource File?
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  2. #2

    PNG -> RES

    Try using editors like Resource Hacker or
    Resource Editor.

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    PNG -> RES

    Neither of them has PNG support
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #4

    PNG -> RES

    You need to create an *.rc file and then compile it into a *.res file
    *.rc files look similar to this...

    BagOMoneyGif 23 "BagOMoney.gif"
    GenericWebViewCss 23 "GenericWebView.css"
    zSorterVerifier 14 "Closer48.ico"
    zSQLWait CURSOR "SQLWait.cur"
    ReportLogo BITMAP "ReportLogo.bmp"
    ProgressThreadAVI AVI "ProgressThread.avi"
    zContentPanelTemplate 23 "ContentPanel.htt"
    ControlPanelhtm 23 "ControlPanel.html"
    Backgroundjpg 23 "Background.jpg"
    PrimaryPNG RCDATA Primary.png
    First comes the ResourceName, then ResourceType and finally quoted path to the resource on your HD.

    As you can see you can pretty much embed anything you like into a resource file.

    Depending on the version of Delphi you are using you can either add the rc to the project and it will automatically compile it into a .res file and embed it or alternatively you can Use brcc.exe to compile the resouce:

    C:\{PATH TO DELPHI}\bin\brcc.exe MyResources.rc

    Then put
    [pascal]
    {$R MyResources.Res}
    [/pascal]
    in either your .dpr file or the unit where you plan to use it.

    The next step is to load the resources. Look into FindResource() and LoadResource() WinAPIs on Google groups.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  5. #5

    PNG -> RES

    How about those two: resource tuner
    and PE explorer.
    They are not freeware but have trial version. If they are no good, the only way I see is to add png file manually i.e. make Your own png resource editor. The resource editor I've mentioned in post above comes with the source code, so You will have a starting point. Or You can make your own resource file. Ther is an article how to make custom resource file and how to add to .exe on http://www.delphi3000.com in games section. Unfortunatelly I cant help You more.

  6. #6

    PNG -> RES

    This brings up a question I have always wanted to know. How to compile resources into a linux binary using freepascal :?: :?:

    Anyone got any ideas :?:
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  7. #7

    PNG -> RES

    Quote Originally Posted by technomage
    How to compile resources into a linux binary using freepascal :?: :?:

    Anyone got any ideas :?:
    This is from the FPC documentation (Programmers's manuall):

    $R or $RESOURCE : Include resource

    This directive includes a resource in the binary. The argument to this directive is the resource to include:
    {$R icons.res}

    Will include the file icons.res as a resource in the binary. Currently resources are supported only for Windows (native resources are used) and for platforms using ELF binaries (linux, BSD).

    The asterix can be used as a placeholder for the current unit/program filename:
    unit myunit;
    {$R *.res}

    will include myunit.res.
    There is a TResourceStream class so (in theory) it is possible to load resource. But I don't know how to make .res files on Linux. Maybe Lazarus has utility for this?

    Finally if someone is interested how to read/write custom data from/to Linux/Windows executable, the ]here[/url].
    Much better then the previous one I gave.

  8. #8

    PNG -> RES

    use 'windres' on Linux to create a resource file. it's in binutils.
    Marmin^.Style

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •