Re: Getting the host
Re: Getting the host
- Subject: Re: Getting the host
- From: Kurt Bigler <email@hidden>
- Date: Mon, 08 Sep 2003 18:39:25 -0700
on 9/3/03 11:30 PM, Urs Heckmann <email@hidden> wrote:
>
Am Donnerstag, 04.09.03, um 07:04 Uhr (Europe/Berlin) schrieb Jim
>
Wintermyre:
>
>
>> I remember this issue coming up once before, and there were a couple
>
>> of
>
>> suggestions for getting the process name and using that. I saved the
>
>> code
>
>> snippets. One way is this:
>
>>
>
>> unsigned char * appname = LMGetCurApName();
>
>>
>
>> That will get you a Pascal string in return. That I think is sort of
>
>> a
>
>> legacy API, and this is probably the better way:
>
>>
>
>> ProcessSerialNumber currentProcess = { 0, kCurrentProcess };
>
>> CFStringRef processName = NULL;
>
>> OSStatus status = CopyProcessName(¤tProcess, &processName);
>
>
>
> Or, you can call GetProcessInformation and look at the
>
> processSignature field of the ProcessInfoRec. This is the app's
>
> creator code (which should be unique and registered with Apple). If
>
> you had to hard-code something to behave differently under a
>
> particular host app, this check would be safer since it's much less
>
> likely to change than the actual name of the app.
>
>
>
> Jim
>
>
Yeah... cool idea!
>
>
However, Bill's law still applies: Don't workround buggy hosts!
>
>
I hope that my request doesn't inspire anyone to start creating
>
workarounds for hosts. Better send them messages with bug fix requests.
>
>
No, my primary intention (rather trivial) is just to identify an
>
instance of my plugin uniquely, so across all open host applications,
>
in a user readable manner. That would best be done by the host name 8-))
Of course, it is possible for the user to make a copy of the host
application file, and to run two copies of it as a result. Now and then
doing this has been essential to me, though I'm sure it is not very
"supported". I don't know whether this will come up for users of audio unit
hosts, but if so, you might want to append the process id to the application
name (or something), if the consequences of non-uniqueness would are truly
problematic.
This might come up for example, if a host only permitted a single active
context (whatever "context" might be), and the user needed to have multiple
contexts active. The user would have no choice but to clone the app to
workaround this.
-Kurt
>
>
Thanks anyway...
>
>
Cheers,
>
>
;) Urs
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.