[comp.sys.mac.programmer] Chooser Name?

yomy@vax5.cit.cornell.edu (02/09/91)

I thought that I remembered seeing this somewhere, so excuse me if this has
already been discussed.  How do you find out what the chooser name is of the
computer your program is running on.  I can't seem to find this anywhere in
inside Mac.  For what it's worth I am programming in Pascal.
Thanks for any help,
Pat Young
yomy@vax5.cit.cornell.edu

mxmora@sri-unix.SRI.COM (Matt Mora) (02/09/91)

In article <1991Feb8.134003.2622@vax5.cit.cornell.edu> yomy@vax5.cit.cornell.edu writes:
>I thought that I remembered seeing this somewhere, so excuse me if this has
>already been discussed.  How do you find out what the chooser name is of the
>computer your program is running on.  I can't seem to find this anywhere in
>inside Mac.  For what it's worth I am programming in Pascal.
>Thanks for any help,
>Pat Young
>yomy@vax5.cit.cornell.edu


Try this:

 procedure GetUserName (var username: str255);
  var
   syshandle: Handle;
   templong: longint;

 begin
  syshandle := GetResource('STR ', -16096);

  if syshandle <> nil then
   begin
    templong := gethandleSize(syshandle);
    BlockMove(ptr(syshandle^), @username, templong);
   end
  else
   username := '';
 end;




Matt


-- 
___________________________________________________________
Matthew Mora                |  my Mac  Matt_Mora@QM.SRI.COM
SRI International           |  my SUN   mxmora@unix.sri.com
___________________________________________________________

peirce@outpost.UUCP (Michael Peirce) (02/09/91)

In article <1991Feb8.134003.2622@vax5.cit.cornell.edu>, yomy@vax5.cit.cornell.edu writes:
> 
> I thought that I remembered seeing this somewhere, so excuse me if this has
> already been discussed.  How do you find out what the chooser name is of the
> computer your program is running on.  I can't seem to find this anywhere in
> inside Mac.  For what it's worth I am programming in Pascal.

VAR
	userName : stringHandle;

    userName := GetString(-16096);


It's stored as a string ("STR ") resource in the System file.

-- michael


--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE

-- Ask me about AppSizer (and ask Claris about Public Folder :-)