home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 8.ddi / OLE.ZIP / OLECLNTE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  5.4 KB  |  112 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2. //
  3. // oleclnte.h
  4.  
  5. // Defines the macros check and wait.
  6. // check is used to see if the last Ole function completed
  7. // successfully.
  8. // wait is used to go into a Message-Dispatch loop until
  9. // an Object is released.  It also checks that the last Ole
  10. // operation was successful.  They are implemented as macros to
  11. // take advantage of the __LINE__ and __FILE__ macros which
  12. // the compiler pre-defines.  This allows one to see which
  13. // line in the source code an error occured at.  They put up
  14. // a message box to display the symbolic constant for the
  15. // error which ole.h declared.  The comments in ole.h sometimes
  16. // give more information on what an error code meant.
  17.  
  18. // Warning: Putting up a MessageBox during the operation of Ole
  19. // functions may be a little dangerous, as the message loop for
  20. // the MessageBox is in Windows.  This means that any un-attended
  21. // messages between the OLE libraries must go through that message
  22. // loop.  A Safer thing to do is output debug strings to a
  23. // monochrome monitor, if available.  For the purposes of this
  24. // example, it should not be a problem.
  25.  
  26. #define check( x ) CheckOleError( x , __LINE__ , __FILE__ )
  27.     //if not OLE_OK, CheckOleError will put up a message
  28.     //box, which could be bad for Ole message dispatching
  29.  
  30. #define wait( x , y) WaitOleNotBusy(  x , y , __LINE__, __FILE__ )
  31.  
  32. void CheckOleError( OLESTATUS , unsigned , char * );
  33. void WaitOleNotBusy( OLESTATUS , LPOLEOBJECT , unsigned, char * );
  34.  
  35.  
  36. #define FARVTBL
  37.  
  38. // TOleStatusTrans is a class used to translate Ole error codes
  39. // to their symbolic constants.  It also serves as an example of using
  40. // Dynamic Dispatching outside of the TWindowsObject hierarchy.
  41. // The class is made huge to ensure that the vtable pointer will
  42. // be far regardless of wether or not a static or dynamic link is
  43. // done with the class.  FARVTBL is defined to make this known
  44. // to the source code which uses this header file.
  45. // The C ole client example uses a switch statement to translate
  46. // error codes to their symbolic constants.
  47.  
  48. class huge TOleStatusTrans {
  49. public:
  50.     virtual LPSTR Ok() = [ OLE_OK ];
  51.     virtual LPSTR WaitForRelease() = [ OLE_WAIT_FOR_RELEASE ];
  52.     virtual LPSTR Busy() = [ OLE_BUSY ];
  53.     virtual LPSTR ErrorProtectOnly() = [ OLE_ERROR_PROTECT_ONLY ];
  54.     virtual LPSTR ErrorMemory() = [ OLE_ERROR_MEMORY ];
  55.     virtual LPSTR ErrorStream() = [ OLE_ERROR_STREAM ];
  56.     virtual LPSTR ErrorStatic() = [ OLE_ERROR_STATIC ];
  57.     virtual LPSTR ErrorBlank() =  [ OLE_ERROR_BLANK ];
  58.     virtual LPSTR ErrorDraw() =   [ OLE_ERROR_DRAW ];
  59.     virtual LPSTR ErrorMetafile() = [ OLE_ERROR_METAFILE ];
  60.     virtual LPSTR ErrorAbort() =  [ OLE_ERROR_ABORT ];
  61.     virtual LPSTR ErrorClipboard() = [ OLE_ERROR_CLIPBOARD ];
  62.     virtual LPSTR ErrorFormat() =  [ OLE_ERROR_FORMAT ];
  63.     virtual LPSTR ErrorObject() = [ OLE_ERROR_OBJECT ];
  64.     virtual LPSTR ErrorOption() = [ OLE_ERROR_OPTION ];
  65.     virtual LPSTR ErrorProtocal() = [ OLE_ERROR_PROTOCOL ];
  66.     virtual LPSTR ErrorAddress() = [ OLE_ERROR_ADDRESS ];
  67.     virtual LPSTR ErrorNotEqual() = [ OLE_ERROR_NOT_EQUAL ];
  68.     virtual LPSTR ErrorHandle() =   [ OLE_ERROR_HANDLE ];
  69.     virtual LPSTR ErrorGeneric() = [ OLE_ERROR_GENERIC ];
  70.     virtual LPSTR ErrorClass() =   [ OLE_ERROR_CLASS ];
  71.     virtual LPSTR ErrorSyntax() = [ OLE_ERROR_SYNTAX ];
  72.     virtual LPSTR ErrorDataType() = [ OLE_ERROR_DATATYPE ];
  73.     virtual LPSTR ErrorPalette() = [ OLE_ERROR_PALETTE ];
  74.     virtual LPSTR ErrorNotLink() = [ OLE_ERROR_NOT_LINK ];
  75.     virtual LPSTR ErrorNotEmpty() = [ OLE_ERROR_NOT_EMPTY ];
  76.     virtual LPSTR ErrorSize() = [ OLE_ERROR_SIZE ];
  77.     virtual LPSTR ErrorDrive() = [ OLE_ERROR_DRIVE ];
  78.     virtual LPSTR ErrorNetwork() = [ OLE_ERROR_NETWORK ];
  79.     virtual LPSTR ErrorName() = [ OLE_ERROR_NAME ];
  80.     virtual LPSTR ErrorTemplate() = [ OLE_ERROR_TEMPLATE ];
  81.     virtual LPSTR ErrorNew() = [ OLE_ERROR_NEW ];
  82.     virtual LPSTR ErrorEdt() = [ OLE_ERROR_EDIT ];
  83.     virtual LPSTR ErrorOpen() = [ OLE_ERROR_OPEN ];
  84.     virtual LPSTR ErrorNotOpen() = [ OLE_ERROR_NOT_OPEN ];
  85.     virtual LPSTR ErrorLaunch() = [ OLE_ERROR_LAUNCH ];
  86.     virtual LPSTR ErrorComm() = [ OLE_ERROR_COMM ];
  87.     virtual LPSTR ErrorTerminate() = [ OLE_ERROR_TERMINATE ];
  88.     virtual LPSTR ErrorCommand() = [ OLE_ERROR_COMMAND ];
  89.     virtual LPSTR ErrorShow() = [ OLE_ERROR_SHOW ];
  90.     virtual LPSTR ErrorDoverb() = [ OLE_ERROR_DOVERB ];
  91.     virtual LPSTR ErrorAdviseNatvie() = [ OLE_ERROR_ADVISE_NATIVE ];
  92.     virtual LPSTR ErrorAdvisePict() = [ OLE_ERROR_ADVISE_PICT ];
  93.     virtual LPSTR ErrorAdviseRename() =[ OLE_ERROR_ADVISE_RENAME ];
  94.     virtual LPSTR ErrorPokeNative() = [ OLE_ERROR_POKE_NATIVE ];
  95.     virtual LPSTR ErrorRequestNative() = [ OLE_ERROR_REQUEST_NATIVE ];
  96.     virtual LPSTR ErrorRequestPict() = [ OLE_ERROR_REQUEST_PICT ];
  97.     virtual LPSTR ErrorServerBlocked() = [ OLE_ERROR_SERVER_BLOCKED ];
  98.     virtual LPSTR ErrorRegistration() = [ OLE_ERROR_REGISTRATION ];
  99.     virtual LPSTR ErrorAlreadyRegistered() = [ OLE_ERROR_ALREADY_REGISTERED ];
  100.     virtual LPSTR ErrorTask() = [ OLE_ERROR_TASK ];
  101.     virtual LPSTR ErrorOutOfDate() = [ OLE_ERROR_OUTOFDATE ];
  102.     virtual LPSTR ErrorCantUpdateClient() = [ OLE_ERROR_CANT_UPDATE_CLIENT ];
  103.     virtual LPSTR ErrorUpdate() = [ OLE_ERROR_UPDATE ];
  104.     virtual LPSTR ErrorSetdataFormat() = [ OLE_ERROR_SETDATA_FORMAT ];
  105.     virtual LPSTR ErrorStaticFromOtherOs() = [ OLE_ERROR_STATIC_FROM_OTHER_OS ];
  106.     virtual LPSTR WarnDeleteData() = [ OLE_WARN_DELETE_DATA ];
  107.     LPSTR Trans( OLESTATUS );
  108.     LPSTR Default();
  109. };
  110.  
  111.  
  112.