Description
Returns information about the batch service on the named server.
Syntax
DWORD BatchGetServerInfo(LPCTSTR server, LPBYTE servinfobuf, DWORD cbsize, LPDWORD cbneeded);
Parameters
LPCTSTR server |
Specifies the server name. If this parameter is null or empty, information about the local batch server is returned. |
LPBYTE servinfobuf |
Buffer space to store a BATCH_SERVER_INFO structure. |
DWORD cbsize |
Specifies the size of the buffer in bytes. |
LPDWORD cbneeded |
Indicates the size of the returned information. If cbsize is too small, ERROR_INSUFFICIENT_BUFFER is returned, and cbneeded is set to the needed size. |
Return Values
BATCH_ERROR_BAD_SERVER_NAME |
The syntax of the server name was invalid. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
LPCTSTR ServName;
LPBYTE ServInfoBuff;
DWORD CbSize,Need,ReturnVal;
char * pTempName;
cout << "STARTING THE EXECUTION OF BATCHGETSERVERINFO API "<< endl;
pTempName = new char [MAX_LENGTH];
if (pTempName ==NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
exit(0);
}
cout << " Enter the Name of the server for which info is required ";
cin >> pTempName;
ServName = (const char*)pTempName;
ReturnVal = BatchGetServerInfo(ServName , NULL , 0 ,&Need);
ServInfoBuff = (LPBYTE)LocalAlloc(0,Need);
if (ServInfoBuff ==NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
delete [] pTempName;
exit(0);
}
CbSize = Need;
ReturnVal = BatchGetServerInfo(ServName, ServInfoBuff,CbSize,&Need);
switch (ReturnVal)
{
case BATCH_ERROR_BAD_SERVER_NAME :
cout << " The syntax of the server name was invalid. " << endl;
break;
default:
cout << "SUCCESSFUL COMPLETION OF GETTING SERVER INFORMATION "<< endl;
}
cout << "COMPLETED THE EXECUTION OF BATCHGETSERVERINFO API "<< endl;
delete [] pTempName;
LocalFree(ServInfoBuff);
}