Re: InternetConfig API
Re: InternetConfig API
- Subject: Re: InternetConfig API
- From: Quinn <email@hidden>
- Date: Mon, 2 Dec 2002 16:21:50 +0000
At 9:55 -0500 2/12/02, Paul Popovich wrote:
Has something changed or am I doing something
completely wrong?
What settings are you trying to change? I recently wrote code to
test the changing of the IC helper application settings and it worked
fine. Try out the following and let me know what you find.
---------------------------------------------------------------
#if defined(__MACH__)
#include <Carbon/Carbon.h>
#else
#include <MacTypes.h>
#include <InternetConfig.h>
#include <PLStringFuncs.h>
#include <LaunchServices.h>
#include <CFStringEncodingExt.h>
#endif
#include <stdio.h>
#include <assert.h>
void main(void)
{
OSStatus err;
OSStatus junk;
ICInstance inst;
fprintf(stderr, "Hello Cruel World!\n");
fprintf(stderr, "Standard.c\n");
err = ICStart(&inst, '????');
if (err == noErr) {
ICAppSpec spec;
ICAppSpec newSpec;
ICAttr junkAttr;
long size;
size = sizeof(spec);
err = ICGetPref(inst, "\pHelper*mailto", &junkAttr, &spec, &size);
if (err == noErr) {
if (spec.fCreator == 'CSOm') {
spec.fCreator = 'emal';
PLstrcpy(spec.name, "\pMail.app");
fprintf(stderr, "Switching to mail.\n");
} else {
spec.fCreator = 'CSOm';
PLstrcpy(spec.name, "\pEudora");
fprintf(stderr, "Switching to Eudora.\n");
}
}
if (err == noErr) {
err = ICSetPref(inst, "\pHelper*mailto", kICAttrNoChange,
&spec, sizeof(spec));
}
junk = ICStop(inst);
assert(junk == noErr);
}
if (err == noErr) {
fprintf(stderr, "Success.\n");
} else {
fprintf(stderr, "Failed with error %ld.\n", err);
}
fprintf(stderr, "Done. Press command-Q to Quit.\n");
}
---------------------------------------------------------------
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.