Resource files and Carbon - PLEASE HELP!

Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default Resource files and Carbon - PLEASE HELP!

    I've been messing with this for hours, and am at my wit's end. If anyone
    has an ideas, please help!

    I find that when using FSpOpenResFile as a Carbon-compatible replacement
    to the old OpenResFile, that my res files no longer behave as they used
    to. Previously, I could open many files, and when trying to load a given
    resource, if it didn't exist in the current file, other open resource
    files would be searched, going backwards in the order that I opened them.

    But once I switch to FSpOpenResFile, I seem to have to use UseResFile()
    to switch between current files, since I seem to only be able to read
    from the current file, even though I'm using GetResource (not
    Get1Resource).

    Is there a way to fix this? Or do I just have to live with it?

    Here's my Carbon-compatible replacement for OpenResFile:

    short MyOpenResFile(Str255 fileName)
    {
    FSSpec dir, file;
    Boolean targetIsFolder, wasAliased;
    short curResRefNum;
    OSErr err = noErr;

    curResRefNum = -1;

    // get directory of application
    err = GetCurrentResFileDirectory(&dir);

    if (err == noErr)
    {
    // get frame resource file, and resolve alias (if any)
    err = FSMakeFSSpec(dir.vRefNum, dir.parID, fileName, &file );
    }

    if (err == noErr)
    {
    err = ResolveAliasFile( &file, true, &targetIsFolder,
    &wasAliased);
    }

    if (err == noErr)
    {
    curResRefNum = FSpOpenResFile(&file,fsRdPerm);
    }

    return curResRefNum;
    }

    -Vern

    --
    --
    EarthLink User <vernjensen@earthlink.net>
    Vern Jensen Guest

  2. Similar Questions and Discussions

    1. <img> tag and resource files for scr-source?
      I want to compile my images into a resource file and then use this for my <img> tags in my table (<table><tr><img scr=(my...
    2. unable to find adobe pdf resource files
      What program are you printing from? I would install the Adobe PostScript Drivers 1.6...
    3. memory mapped files under Carbon
      Hi I'm wondering if there's any way to do memory mapped file access under MacOS 9 and X with a Carbon application. OpenMappedFile isn't part of...
    4. HELP: Fireworks can not run. The resource files are missing or damaged
      I get this message whenever I try and run Fireworks MX. Dreamweaver MX and the rest of Studio MX runs just fine, except for fireworks. I have no...
    5. Using Resource Files
      Hi, I have been trying to search for a tutorial that can walk me through a sample page using the .resx files that are shown in VS.NET using...
  3. #2

    Default Re: Resource files and Carbon - PLEASE HELP!

    Hello Vern,

    I'm not exactly sure about this, but I believe you cannot be sure in Carbon
    that the opened resource file is appended to the end of the resource chain.

    This must be the reason for Apple having added some new resource manager
    calls for manipulating the resource chain.

    Maybe a call to the function InsertResourceFile(file, kRsrcChainBelowAll)
    after opening it will solve your problems.

    I never had problems because I always called UseResFile after loading a
    file.

    ----------------
    Sebastian Wegner

    [url]http://www.mcsebi.com/[/url]

    Sebastian Wegner Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139