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

  1. /*
  2.  * File......: GETOBJID.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_gBndOID()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Get Bindery Object Id
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_gBndOID(<cObjectName>, <nObjectType>) => nObjectId
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *     <cObjectName> is the name of the Object that you are trying
  34.  *             to read the property info for.  Max Length = 47
  35.  *
  36.  *     <nObjectType> is the Bindery Object Type.  Manifest constants
  37.  *             describing the defined types are included in the
  38.  *             NETTO.CH header file.
  39.  *
  40.  *  $RETURNS$
  41.  *
  42.  *     Returns the bindery objectid of the bindery object name passed.
  43.  *     The ID is returned as a Clipper Numeric value.
  44.  *
  45.  *  $DESCRIPTION$
  46.  *
  47.  *     This function returns a bindery object's unique id number.
  48.  *
  49.  *  $SEEALSO$
  50.  *     fn_BndONam()
  51.  *  $EXAMPLES$
  52.  *
  53.  *     cObject := "EVERYONE"
  54.  *     nType     := OT_USER_GROUP
  55.  *
  56.  *     // this will return the object id of the object EVERYONE
  57.  *     nId := FN_gBndOid(cObject, nType)
  58.  *     QOut(nId)
  59.  *
  60.  *  $END$
  61.  */
  62.  
  63. #include "netto.ch"
  64.  
  65. #xcommand DEFAULT <v1> TO <x1> [, <vN> TO <xN> ];
  66.       => IIF((<v1>)=NIL,<v1>:=<x1>,NIL) [; IF((<vN>)=NIL,<vN>:=<xN>,NIL)]
  67.  
  68. #define NW_LOG 227
  69.  
  70. #ifdef FT_TEST
  71.   FUNCTION MAIN(cObjectName, nObjectType)
  72.     LOCAL   nId
  73.     DEFAULT cObjectName TO "EVERYONE"
  74.     DEFAULT nObjectType TO OT_USER_GROUP
  75.  
  76.     IF ValType(nObjectType) == "C"
  77.       nObjectType := Val(nObjectType)
  78.     ENDIF
  79.  
  80.     nId := FN_gBndOid( cObjectName, nObjectType)
  81.  
  82.     QOut(nId,cObjectName,nObjectType)
  83.  
  84.   RETURN ( nil )
  85. #endif
  86.  
  87.  
  88. FUNCTION FN_gBndOID(cName, nType)
  89.   LOCAL cReceive := Space(54)         // Set up Receive Buffer
  90.   LOCAL nRetVal  := 0
  91.   LOCAL cSend     := I2BYTE(53) ;     // 35h  API Function Request Code
  92.           + W2HILO(nType) ;     // Object Type
  93.           + FN_NameL(alltrim(cName), 48)  // Length Encoded Object Name
  94.  
  95.    IF _fnReq(NW_LOG, cSend, @cReceive) == ESUCCESS
  96.      nRetVal := HILO2L(Left(cReceive, 4))      // Return ID as a number
  97.    ENDIF
  98.  
  99. RETURN nRetVal
  100.