Searches a queue for a queue element. You can search for the element by specifying a string, an integer, or both. You can remove the element from the queue by adding 8 to the Mode.
Note: This function may modify the arguments Type and Str depending on the Mode. Therefore, these arguments need to be variables. You should consider that they may be impacted by the setting for Mode when calling the function.
QuePeek(hQue, Type, Str, Mode)
The queue handle, returned from the QueOpen() function. The queue handle identifies the table where all data on the associated queue is stored.
The number to search for (if using the search mode for a matching number). If you are using a matching string mode, the number found is returned in Type.
The string to search for (if using the search mode for a matching string). If you are using a matching number mode, the string found is returned in Str.
The mode of the search:
1 - Search for a matching string.
2 - Search for a matching number.
4 - Search for a matching string and use a case-sensitive search.
8 - If the element is found, remove it from the queue.
16 Search the queue, in order, for the element at the offset specified by Type.
Use mode 16 when you know the location of the element you want. For example if you set Type = 0, QuePeek will return the first element in the queue, type = 2, will return the 3rd element in the queue, etc. If you specify an offset which is greater than the length of the queue, the "queue empty" error (296) is returned.
You can extend the search by adding modes. For example, set Mode to 3 to search for a matching string and matching number, or set Mode to 11 to also remove the string and number from the queue.
0 (zero) if successful, otherwise an error is returned.
QueClose, QueLength, QueOpen, QueRead, QueWrite
! search for 'mystring' in queue, don't remove if found
Str = "mystring";
IF Status = 0 THEN
! Now use found Type