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: Getting the Computer Name



Is there also a way to replace the computer name and owner name with a
string of your choosing? Thanks in advance.

>Subject: Re: Getting the Computer Name
>From: "winjer" <email@hidden>
>Date: Sat, 20 Jan 2001 03:30:30 +0000
>
>Travis J. Hicks wrote:
>
>>I have a quick question. How can I get the computer name, as set in the
>>File Sharing control panel, in REALbasic? Can I get it via a system
>gestalt
>>value or via an Apple Event?
>
>Either from the System resource:
>
>Function ComputerName() As String
> Dim r, mch as String
> Dim Length as Integer
> r = App.ResourceFork.GetResource("STR ", -16413) // Owner is -16096
> Length = Asc(Left(r, 1))
> mch = Mid(r, 2, Length)
> Return mch
>End Function
>
>or with an AppleEvent:
>
>Function ComputerName() As String
> Dim ae as AppleEvent
> ae = NewAppleEvent("mchn", "getd", "MACS") // Change mchn to ownn
> If ae.send then // to get the owner
> Return ae.ReplyString
> End if
>End Function
>
>I don't think there's a gestalt for this.
>
>winjer
>--
>Don't *type* defaults...
><http://jxzz.com/software/osx/>




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.