Chapter 2 ActiveX C++ Interface Reference
Provides utility methods for use in Jaguar ActiveX components.
To create an IJagServer interface pointer, use the PROGID, "Jaguar.JagServer.1". Call the OLE routines CLSIDfromProgID and CoCreateInstance. CoCreateInstance returns an interface pointer for a given ActiveX class ID string. CLSIDfromProgID obtains the class ID string that CoCreateInstance requires.
To use the IJagServer and IJagServerResults interfaces, you must include JagAxWrap.h. Additionally, you must include JagAxWrap_i.c in only one source file for your component DLL. JagAxWrap.h contains interface definitions for the documented interfaces. JagAxWrap_i.c declares symbols that are required by the ActiveX CoCreateInstance routine.
WARNING! | You will get duplicate-symbol link errors if you include JagAxWrap_i.c in more than one source file for your component DLL. |
Chapter 8, "Creating ActiveX Components" in the Jaguar CTS Programmer's Guide
Write a message to the server's log file.
#include <JagAxWrap.h>
HRESULT IJagServer::WriteLog(
VARIANT_BOOL useTimeStamp,
BSTR message)
useTimeStamp
VARIANT_TRUE
if
the current date and time should be prepended to the log message; VARIANT_FALSE
otherwise.
message
A message to be written to the server's log file.
This method records a message in the server's log file.
By convention, errors that occur on the server are recorded in the log. Log messages should contain enough detail for an administrator or programmer to troubleshoot the cause of the error.
After recording error information in the log, you can also send a concise description of the error by raising an OLE automation exception.
The default log file name is srv.log; it can be changed in the Debug/Trace tab of the server's property sheet. For instructions on accessing the property sheet, see "Jaguar Configuration" in the Jaguar CTS System Administration Guide.
When coding in C++, you can call the C routine JagLog instead of IJagServer::WriteLog. Calling the C routine avoids the overhead incurred by creating an IJagServer interface pointer.
The following C++ code fragment creates an IJagServer interface pointer and calls WriteLog to log the message "Hello, logfile":
HRESULT hr;
IJagServer *p_ijs;
CLSID clsid_js;
BSTR msg;
// Create an IJagServer interface pointer
hr = CLSIDFromProgID(L"Jaguar.JagServer.1", &clsid_js);
// ... deleted error checking ...
hr = CoCreateInstance(clsid_js, NULL,
CLSCTX_INPROC_SERVER,
IID_IJagServer,
(void**)&p_ijs);
// ... deleted error checking ...
msg = SysAllocString(L"Hello, logfile\n");
// ... deleted error checking ...
hr = p_ijs->WriteLog(VARIANT_TRUE, msg);
// ... deleted error checking ...
Chapter 8, "Creating ActiveX Components" in the Jaguar CTS Programmer's Guide
JagLog in Chapter 5, "C Routines Reference"
Copyright © 2000 Sybase, Inc. All rights reserved. |
![]() |