Ask a Question related to Mac Programming, Design and Development.
-
Vern Jensen #1
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
-
<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... -
unable to find adobe pdf resource files
What program are you printing from? I would install the Adobe PostScript Drivers 1.6... -
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... -
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... -
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... -
Sebastian Wegner #2
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



Reply With Quote

