Help with Macintosh programming

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

Archive for April, 2011

IPNetSentry Firewall and ResEdit

I just bought IPNetSentry for the macintosh.  Here’s the problem maybe someone can help me with.

In order to set the intrusion triggers, I have to go through the sustworks.com website.  I don’t want to because I don’t want anyone to have a record of which ports I’m protecting and which ports I’m not.  I think the program can protect only 64 ports, either tcp or udp.

When I tried to change the config file with simple text, the program would no longer read it.  When I tried to add a file creator type with resedit (NScp), it added it to the config file, but the program still couldn’t read it.  I know there must be something I have to do with ResEdit but I’m not sure what because I have no experience programming with it.  Does anyone here know what I’m talking about?  Can someone give me a brief howto?

Do other firewall programs protect more ports?

.
posted by admin in Uncategorized and have Comment (1)

Posting keyboard events under carbon

Does anyone know of a way under Carbon to post keyboard events to the
front process? Under OS9, I used to use PPostEvent. But PPostEvent is
not supported under carbon. I have tried PostEvent, PostEventToQueue,
and SendEventToApplication, but they all seem only capable of posting
events to yourself. My application is a background app that generates
"fake" keyboard events (a keyboard macro facility).

posted by admin in Uncategorized and have Comments (4)

Contextual menu plugins and MacOS X

Dear group,

Until recently MacOS X did not support the Contextual Menu Plugins that
the MacOS 8/9 Finder supports. This has changed recently and CMMs are
now apparently supported.

Unfortunately the only documentation on the new style plug-ins that I
can find comes from menu.h (included at the end of the posting) and I
seem to be unable to get this to work for me without a bit of sample
code or friendly advice..

Has anybody implemented a CMM for OS X? Is there any other
documentation available? Or better still does anybody have some example
code?

I am really desperate to get this to work asap. and would really
appreciate your help.

Best regards

Frank
re…@publicspace.net

My documentation:

/*‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹
‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹*/
/*  € Contextual Menu Plugin Notes                                                    
*/
/*                                                                                    
*/
/*  For Mac OS X, we will support a new type of Contextual Menu Plugin:
the CFM-based   */
/*  plugin. Each plugin must be a separate file in the Contextual Menu
Items subfolder  */
/*  of the system folder. It must export two functions and has the
option of exporting  */
/*  a third; these three functions are virtually identical to the
methods that must be  */
/*  supported by a SOM-based plugin.                                                      
*/
/*                                                                                    
*/
/*  The required symbols must be named "ExamineContext" and
"HandleSelection".          */
/*  The optional symbol must be named "PostMenuCleanup".                              
*/
/*                                                                                    
*/
/*  The ExamineContext routine must have the following prototype:                      
*/
/*      pascal OSStatus ExamineContext( const AEDesc* inContext,                      
*/
/*                                      AEDescList* outCommandPairs );                
*/
/*                                                                                    
*/
/*  The HandleSelection routine must have the following prototype:                    
*/
/*      pascal OSStatus HandleSelection(    const AEDesc* inContext,                  
*/
/*                                          SInt32 inCommandID );                      
*/
/*                                                                                    
*/
/*  The PostMenuCleanup routine must have the following prototype:                    
*/
/*      pascal void PostMenuCleanup(     void );                                          
*/
/*‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹
‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹‹*/

posted by admin in Uncategorized and have Comment (1)

crash in ExitToShell

I’ve got a reproducible crash in ExitToShell.  It apparently only happens
on Mac OS 9.x, when my app (Fetch) is launched with an AppleScript, and
virtual memory is turned off.

Does anyone have any ideas what I could be leaving behind for ExitToShell
to trip over?

Thanks!


Jim Matthews
Fetch Softworks
http://fetchsoftworks.com

posted by admin in Uncategorized and have Comments (5)

UpdateStandardFontMenu

When using UpdateStandardFontMenu on a hiearchial font menu, it seems to
update the menu fine. However, the submenu’s don’t seem to update properly
and the result is a menu that has submenu’s attached to incorrect menu
items.

For example, suppose font "BBB" is the first menu item and has a submenu of
"Regular" and "Bold". If UpdateStandardFontMenu was to insert font "AAA"
before "BBB" (because "AAA" was activated after the CreateStandardFontMenu),
font "AAA" would now have font "BBB"’s submenu attached to it.

Is this a "bug" in the API or am I missing something? If it is a bug, does
anyone have any good ideas for work-arounds. I presume I could use
"CreateStandardFontMenu" again, but I suppose to do that I will have to
clear the current menu’s contents and delete all of the submenu’s first.

Any advice would be greatly appreciated.

Matheau Dakoske

Code Line Communications
http://www.code-line.com/software

posted by admin in Uncategorized and have No Comments

keymap for OS X

Hi,

Could anybody help me?

I am looking for some information to make a "key-map" to type under OS
X. I need to type in Vietnamese but not using  Unicode system.

Is possible to find a example in C? Perhaps there is a utility that
makes this?

Thank you.
Sergio

posted by admin in Uncategorized and have Comment (1)

Mach-O runtime docs

Hey all –
   I just decided to sit down and write a guide to writing assembly
code for the Mac. I’d like it to be up-to-date, but unfortunately, my
experience with X is near nil.
   Could anyone point me to a resource on the Mach-O runtime
conventions? I can’t find much of anything – just that there’s no TOC,
and globals are relative to a base pointer to code.
   Who loads this base pointer? Is it kept in r2, like rtoc? How are
the enormous offsets involved handled by puny little addi’s?
   Are there any other differences between CFM and Mach-O that I should
be aware of? Or between the grammars of PPCAsm and whatever assembler’s
in PB? (I haven’t tried to do the research for this yet…)

   Also, if anyone’s interested in writing a chapter or whatever, the
project is open to all.

   - Potatoswatter

posted by admin in Uncategorized and have Comments (7)

CW keyword pascal

Beginner C programmer.
———————————
CW C compiler recognizes the keyword ‘pascal’ however in the
C_Compilers_Reference.pdf the only description they offer is:

"This keyword is used in MacOS programming."

and that’s it. Does anyone know where I can find information about this
keyword. I know Pascal was the main language used by Apple a while back, but
what does this keyword actually do?

here is snippets from different headers from the Adobe Illustrator SDK

#define SPAPI pascal

typedef long SPErr;
typedef SPAPI SPErr (*SPEntry)(char *caller, char *selector, void *message)
{
        /* more statements here . . . */

}

so I’m trying to figure out how does the keyword pascal works in this statement
if I was to substitute it like this
typedef pascal SPErr . . .

thanks in advance
Vee!
vceles…@aol.com

posted by admin in Uncategorized and have Comment (1)

Linking to libcurses.dylib

Hi,

I have a simple C program that I’m trying to compile on an OS X
machine with "cc".  It uses the curses library which should be
available on OS X (I found a "/usr/include/curses.h" and
"/usr/lib/libcurses.dylib").  When I try to compile, it works fine,
but when it tries to link, I get unresolved symbol errors (from the
curses library).

Does anyone know if I am supposed to be able to link to a "dylib"
file, and if so, how I should do it with "cc"?  I am using something
like "cc file.o /usr/lib/libcurses.dylib".

Also, does anyone know that if I do get this to compile and link
properly, whether the resulting executable will run on pre-OS-X
machines?  I want this program to run on all macs, not just OS X
machines.  Will parts of this dylib get compiled into the executable?
Or is there some other version of the curses library avail for older
macs that I could distribute and should use?

Thanks,
Jason

posted by admin in Uncategorized and have No Comments

Newbie: Painting Pixels in AppWindows under OS X/Carbon?

Hi.

I’m new to programming under OS X.  I checked out some examples
that come with the Developer package (by the way: nice job done by
Apple providing this stuff for free); both Cocoa and Carbon.

But I still don’t have a clue how I should go about this:

I want to build a Carbon app (with or without Nib) that opens a
window to draw an image by setting individual pixels.  This could
be done with an extra bitmap that is copied to window, each time
it gets redrawn or by drawing into the window directly.

I’ve done this already: starting from the HelloWorld example I
tried various graphics operations using Quartz CoreGraphics Contexts.
However I cannot address single pixels.

I want to use Carbon rather than Cocoa, because I want to integrate
other C/C++ library code into it later on.  I checked out some samples
from the Apple developer page, but couldn’t find one that explains it
to me. Or I was looking in the wrong place.

Are there examples of doing this on the web? I know that Kevin Bricknell
has some pretty serious things in his free MacOS C Programming guide
(also very well done). Can I just use those?

Or is there a simple demo app with sources available on the net? Like
something that draws the Mandelbrot/Julia set in a window?

Thanks in advance,

        -Arnulf

posted by admin in Uncategorized and have Comments (8)