home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / BINDERY / GETNAME.PRG < prev    next >
Text File  |  1993-02-23  |  2KB  |  99 lines

  1. /*
  2.  * File......: GETNAME.PRG
  3.  * Author....: Kevin Maher/Steve Tyrakowski
  4.  * CIS ID....: 73766,1224
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  *
  9.  * This is an original work by Kevin Maher and Steve Tyrakowski
  10.  * and is placed in the public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *     FN_BndONam()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Get Bindery Object Name
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_BndONam(nId, [@nType]) => cObjName
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *     <nId> is the object ID you want to look up. It must  be
  34.  *     expressed as an integer.
  35.  *
  36.  *     [@<nType>] is an optional parameter that should be passed by
  37.  *     reference.  It will be set to the Bindery Object Type.  Manifest
  38.  *     constants describing the defined types are included in the
  39.  *     NETTO.CH header file.
  40.  *
  41.  *  $RETURNS$
  42.  *
  43.  *     <cObjName>, the name of the object that corresponds with the id
  44.  *     number.  If <cObjName> is empty, an error occured.  Check
  45.  *     fn_error().
  46.  *
  47.  *  $DESCRIPTION$
  48.  *
  49.  *     This function returns the object name and type for the passed Bindery
  50.  *     object id number.
  51.  *
  52.  *  $SEEALSO$
  53.  *     fn_gBndOId()
  54.  *  $EXAMPLES$
  55.  *
  56.  *      nId := Fn_gbndOId("STEVE", OT_USER)
  57.  *      IF fn_error() == 0
  58.  *         cName := FN_BndONam(nId, @nType)
  59.  *         Qout(cName,nType)     // result: STEVE 1
  60.  *      ENDIF
  61.  *
  62.  *  $END$
  63.  */
  64.  
  65. #include "ftint86.ch"
  66. #include "netto.ch"
  67.  
  68. #define NW_LOG 227
  69.  
  70. #ifdef FT_TEST
  71.   FUNCTION Main(nId)
  72.   LOCAL nType
  73.   LOCAL cName
  74.     nId := Val(nId)
  75.     cName := FN_BndONam(nId,@nType)
  76.     QOut(nId,cName,nType)
  77.   RETURN ( nil )
  78.  
  79. #endif
  80.  
  81. FUNCTION FN_BndONam(nId, nType)
  82. LOCAL cReceive := Space(54)
  83. LOCAL cRetVal  := ""
  84.  
  85.   IF ValType(nId) == "N"
  86.     nId := L2HILO(nId)
  87.     //36h  API request code
  88.     IF _fnReq(NW_LOG, Chr(54)+nId, @cReceive) == ESUCCESS
  89.       nType   := HILO2W(Substr(cReceive, 5, 2))  // return object type
  90.       cRetVal := fn_NoNull(Substr(cReceive, 7))  // name of object
  91.     ELSE
  92.       nType   := OT_UNKNOWN     // on error, object type is unknown
  93.     ENDIF
  94.   ELSE
  95.     _fnseterr( EBADPARM )
  96.   ENDIF
  97.  
  98. RETURN (cRetVal)
  99.