Description
Gets information about the named queue.
Syntax
DWORD BatchGetQueueInfo(LPCTSTR queue, DWORD level, LPBYTE qbuff, DWORD cbsize, LPDWORD cbneeded);
Parameters
LPCTSTR queue |
Specifies the queue name. |
DWORD level |
Specifies the amount of information to be returned for each job. Currently, only levels 1 and 2 are supported, which correspond to the BATCH_QUEUE_INFO_1 and BATCH_QUEUE_INFO_2 structures, respectively. |
LPBYTE qbuff |
Buffer space to store a BATCH_QUEUE_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_NO_SUCH_QUEUE |
The system could not find the named queue. |
ERROR_INVALID_LEVEL |
The level parameter is not 1 or 2. |
BATCH_ERROR_BAD_QUEUE_NAME |
The syntax of the queue name was not valid. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
char* pTemp;
LPCTSTR QueName;
LPBYTE QBuff;
DWORD ReturnVal;
DWORD Level;
DWORD CbSize;
DWORD Need;
cout << " STARTING THE EXECUTION OF BATCHGETQUEUEINFO API "<< endl;
pTemp = new char[MAX_LENGTH];
if (pTemp == NULL){
cout << "unable to allocate the memory.\n Exiting"<<endl;
exit(0);
}
cout << " Please enter the name of the Queue ";
cin >> pTemp;
QueName = (const char *) pTemp;
cout << " Enter the Level of Enumeration required ";
cin >> Level;
ReturnVal = BatchGetQueueInfo( QueName, Level, NULL, 0, &Need);
QBuff = (LPBYTE) LocalAlloc (0,Need);
if (QBuff == NULL){
cout << "unable to allocate the memory.\n Exiting"<<endl;
delete [] pTemp;
exit(0);
}
CbSize = Need;
ReturnVal = BatchGetQueueInfo( QueName, Level, QBuff, CbSize, &Need);
switch(ReturnVal)
{
case BATCH_ERROR_NO_SUCH_QUEUE :
cout << " The system could not find the named queue. "<< endl;
break;
case ERROR_INVALID_LEVEL :
cout << " The level parameter is not 1 or 2. " << endl;
break;
case BATCH_ERROR_BAD_QUEUE_NAME :
cout << " The syntax of the queue name was not valid. " << endl;
break;
default:
cout << "SUCCESSFUL COMPLETION OF GETQUEUEINFO "<< endl;
}
cout << " COMPLETED THE EXECUTION OF BATCHGETQUEUEINFO API "<< endl;
delete [] pTemp;
LocalFree(QBuff);
}