• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: User friendly machine name (gestaltUserVisibleMachineName?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User friendly machine name (gestaltUserVisibleMachineName?)


  • Subject: Re: User friendly machine name (gestaltUserVisibleMachineName?)
  • From: Vince DeMarco <email@hidden>
  • Date: Fri, 30 May 2003 08:33:53 -0700

On Friday, May 30, 2003, at 4:46 AM, Rolf wrote:

Hi,

I'm trying to wrrite 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;



Look up the docs for

SCDynamicStoreCopyLocalHostName()

vince
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >User friendly machine name (gestaltUserVisibleMachineName?) (From: Rolf <email@hidden>)

  • Prev by Date: Re: NSString from Carbon by AppleEvent
  • Next by Date: Re: Status of Java Bridge?
  • Previous by thread: User friendly machine name (gestaltUserVisibleMachineName?)
  • Next by thread: How do I create system wide CMM's
  • Index(es):
    • Date
    • Thread