Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for October, 2011

Custom Icons for documents

I would like to create custom icons for each of the documents my application
creates (like photoshop does),

I know that I need to create an icon resource with an ID of -16455 for the
finder to display it instead of the generic icon.

I know how to add the icon to the resource fork of my files.

But I don’t know how to generate the icon resources programmatically.


posted by admin in Uncategorized and have Comment (1)

Difference between OS 9 as startup and OS 9 called from OS X

I have a very old program that uses windows for text output.  This has
survived through the various upgrades from OS 7 to OS 9.  But the text
windows don’t show properly under the same OS 9 when the classic
environment is called from OS X.  I apologise for queries about such old
programs, but I wonder whether there is any source of information on the
difference between OS 9 loaded at startup and OS 9 loaded from OS X.  One
obvious difference is the dock, but hiding that doesn’t help.

posted by admin in Uncategorized and have Comment (1)

Setting Unix file permissions on OS X

Hi All,

By default (umask 022 I think), when I create a file its permissions are
set to rwxr-xr-x. How do I set this to rwxrwxrwx?

Malcolm Haylock
(remove NOSPAM)

posted by admin in Uncategorized and have Comments (4)

hacking pci firewire

I have an old umax s900 (8500) which i have installed a macally pci firewire
board in.

os 9.1-9.22

firecracker can be used to read the roms off devices that are connected, but
the devices don’t show up.

if i move the card & drive to a g3 everything works ok.

or what might be in a g3 rom that is not covered by the fire wire support

i’m looking for the base address of the pci card, so that i can play about
with the config of the macally pci card (load new valus into the chip)

can anyone give me any pointers


posted by admin in Uncategorized and have Comment (1)

Makefile for Carbon newbies

I want to create a makefile for a _large_ Carbon project.
Does anyone have any references I can look over? I can use all the
information I can get.

I know I could set it up in Project Builder, but I would like some
Makefile experience.

tim lindner                    tlind…

posted by admin in Uncategorized and have No Comments

Keyboard events and OpenGL/GLUT

I’ve been compiling some OpenGL/GLUT apps to Jaguar (OS-X 10.2).
They work on SGI, Dec Alpha, Linux (various flavours), and SUN
meaning that they have minimal trickiness. They compile fine
under OS-X using a simple makefile setting the GLUT framework
and changing things like GL/ includes to GLUT/….minimal changes
so I’m happy since I want to minimise cross platform stress.

HOWEVER, my application never gets any keyboard events, they seem
to be captured by the shell I run my program from. This clearly
seems like a bug since it evidently isn’t the case before 10.2.
I install simple GLUT event handlers as per

Has anyone else encountered this, know of a work around or know
when Apple will fix it. Any Apple engineers listening? Anyone,
please feel free to email comments/suggestions.

ps: I have the latest DevTools and the August patch.

P a u l   B o u r k e
Visualisation Research Fellow

posted by admin in Uncategorized and have Comments (2)

Access permission while sharing file between two or more application.

Hi All,
   I assume that the question that i am asking should not be a big
issue…but i have been unable to make it work properly.
   I want to write to a file which can be read or written to by
another application. I want to lock the file while writing such that
the other application cant open it for "reading" or "writing". From
what i read in Inside Mac: Files in such case it should be opened with
fsRdWrPerm( which means exclusive permission). and if the file is
already opened it would return me permErr. But when i went to test it
by making two application which accesses the same file and then
debugging it, it didnt gave me any error. What i did was to set a
breakpoint after opening the file with fsRdWrPerm and leaving the file
opened i ran the second appliation in debugging mode with similar
setting. now the FSpOpenDF() should have given me some error but it
didnt. Can anyone tell me why is it so.
I also read the Technical Note "FL 37 – You Want Permission to do
What?!!" and used the FSpOpenAware(). But even that was allowing me to
write to a file which was opened from another application during
Is there a way by which I can check whether the file is already opened
for reading/writing and if it is i can wait for some time and try
Also, this is a basic one…If I am writing to a file and if the other
application opens it for reading in between, will it get the
incomplete contents…i.e. Will it read only the data which i have
written or the data which was there previous to when i opened the
I will be greatful for any help.

posted by admin in Uncategorized and have Comments (2)

copying a document


I am adding the use of the application support folder to my (Carbon)
app, to store some app specific documents. When the user first starts
the app, the support docs have to be copied from the folder of the app
to /Application Support/MyApp (both OS 8/9 and OSX). Then the app
stores the FSRef in a global variable, for use throughout the program.
The next time it will just get the FSRef directly from the support

I have been able to get an FSRef for the MyApp folder, but then I am
lost what to do. What  calls can I use to copy the files from the
directory where MyApp is to the support directory? The Carbon docs
only briefly describes each function, which sometimes makes it a
guessing game what function should be the most useful.

On a related note, what is the advantage of using FSRef instead of
FSSpec (in these cases)?


- Koen.

posted by admin in Uncategorized and have No Comments

List of all local disk in AppleScript

Surely an easy one:

how to get the list of all local disk in AppleScript ?

Alain Birtz
Internet abz_ANTiSP…, abirtz_ANTiSP…
Remove _ANTiSPaM_ in the email address
Enlever _ANTiSPaM_ dans cette adresse electronique

posted by admin in Uncategorized and have Comment (1)

Problem printing from console in Jaguar

In Mac OS 10.1 I was able to print files from a console using the command:

Print <filename>

However, in Mac OS 10.2 (Jaguar) I am getting the error message:

Print:  Command not found

Can anyone tell me what I need to do to fix this problem?

Jesus Dapena

posted by admin in Uncategorized and have Comment (1)