Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: User friendly machine name (gestaltUserVisibleMachineName?)



Try the carbon call CSCopyMachineName and CSCopyUserName if you need it as
well.

This looks to be in the CoreServices framework

The string resource method no longer works on OS X.

Bryan


> ----------
> From: Rolf
> Sent: Friday, May 30, 2003 2:16 PM
> To: email@hidden
> Subject: User friendly machine name (gestaltUserVisibleMachineName?)
>
> Hi,
>
> I'm trying to write a method to determine the user friendly machine name
> (For example "PowerBook G4") in a Cocoa app. As far as I know the Carbon
> Gestalt Manager has to be used, and the gestaltUserVisibleMachineName
> looks like the correct selector. I wrote the attached code but it
> doesn't work. Gestalt() succeeds and it returns a seemingly correct value.
> However GetIndString makes sMachineName into an empty string. Does anybody
> know why ?
>
> I know about the uname method but it doesn't really return the true and
> full user friendly machine name.
>
> NSString * result = @"Unknown";
> SInt32 gestaltReturnValue;
> if (!Gestalt(gestaltUserVisibleMachineName, &gestaltReturnValue))
> {
> Str255 sMachineName;
> GetIndString(sMachineName,kMachineNameStrID,gestaltReturnValue);
> result = [NSString stringWithCString:(StringPtr)&sMachineName];
> }
> return result;
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.