Description
Sets attributes for the batch service on the named server. Invalid or missing values are ignored. The caller must have management access to the server. The following attributes can be set:
-
debuglevel
-
defaultqueue
-
pSD
Syntax
DWORD BatchSetServerInfo(LPCTSTR server, BATCH_SERVER_INFO servinfo);
Parameters
LPCTSTR server |
Specifies the server. If this parameter is NULL or empty, the local server is used. |
BATCH_SERVER_INFO servinfo |
A BATch_Server_Info structure containing the server information to set. |
Return Values
BATCH_ERROR_BAD_SERVER_NAME |
The syntax of the server name was not valid. |
BATCH_ERROR_MANAGER_ACCESS_DENIED |
The user does not have manager privileges. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
LPTSTR DefQue;
LPCTSTR ServName;
LPBYTE ServBuff;
char * pTempName;
char * pTempQue;
DWORD ReturnVal;
DWORD CbSize;
DWORD Need;
DWORD DebugLevel;
BATCH_SERVER_INFO * ServInfo;
cout << "STARTED EXECUTION OF BATCHGETSERVERINFO API" << endl;
cout << " The Caller Must have Manager privileges and can set any of "<< endl
<< " the following attributes only. debuglevel defaultqueue pSD "<< endl;
pTempName = new char [ MAX_LENGTH];
if (pTempName == NULL) {
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
exit(0);
}
pTempQue = new char[MAX_LENGTH];
if ( pTempQue == NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
delete [] pTempName;
exit(0);
}
cout << " Enter the name of the server for which to set the info ";
cin >> pTempName;
ServName = (const char *)pTempName;
ReturnVal = BatchGetServerInfo(ServName, NULL,0,&Need);
ServBuff = (LPBYTE) LocalAlloc(0,Need);
if (ServBuff == NULL) {
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
delete [] pTempName; delete [] pTempQue;
exit(0);
}
CbSize = Need;
ReturnVal = BatchGetServerInfo(ServName,ServBuff,CbSize,&Need);
cout << " Enter the Default Queue to set for the server ";
cin >> pTempQue;
DefQue = (char *)pTempQue;
cout << " Enter the Debug level for Log file to set for the Server ";
cin >> DebugLevel;
ServInfo = (BATCH_SERVER_INFO *)ServBuff;
ServInfo->debuglevel = DebugLevel;
ServInfo->defaultqueue = DefQue;
ReturnVal = BatchSetServerInfo(ServName,*ServInfo);
switch(ReturnVal)
{
case BATCH_ERROR_BAD_SERVER_NAME :
cout << " The syntax of the server name was not valid. " << endl;
break;
case BATCH_ERROR_MANAGER_ACCESS_DENIED :
cout << " The user does not have manager privileges. " << endl;
break;
default:
cout << "SUCCESSFUL COMPLETION OF BATCHSETSERVER INFORMATION"<< endl;
}
cout << " COMPLETED EXECUTION OF BATCHGETSERVERINFO API " << endl;
delete [] pTempName;
delete [] pTempQue;
LocalFree(ServBuff );
}