This method retrieves the number of elements in the array that will be returned when a supported item is retrieved from the printer specified by the printer name.
Parameters
Name | Explanation |
---|---|
CapNo | The type of item retrieved (0: Paper size, 1: Paper tray, 2: Resolution) |
In Visual Basic the following constants can be used: (ikPrinterPaperSize = 0, ikPrinterPaperBin = 1, ikPrinterResolution = 2).
Return Value
Returns the number of retrieved items. Returns 0 if unsuccessful.
Explanation
This method retrieves the number of elements in the array returned whenever a supported item is retrieved from the printed specified by the printer name. The EnumPaperSizes, EnumPaperBins, and EnumResolutions methods pass arrays as parameters and the GetArrayNum method can be used to find out how many elements are contained in those arrays.
Sample code:
Visual Basic
Dim Size As Long
Dim XResolutions() As Long
Dim YResolutions() As Long
Dim Ret As Long
Size = ImageKit1.PrintDraw.GetArrayNum(2)
If Size < 1 Then Exit Sub
ReDim XResolutions(Size)
ReDim YResolutions(Size)
Ret = ImageKit1.PrintDraw.EnumResolutions(XResolutions(0), YResolutions(0))
'various programming code
Visual C++
long Size;
long *XResolutions;
long *YResolutions;
ImageKit1.GetPrintDraw().SetPrinterName("EPSON LP-8200C");
Size = ImageKit1.GetPrintDraw().GetArrayNum(2);
if (Size < 1) return;
XResolutions = (long *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
YResolutions = (long *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(long) * Size);
__try {
ImageKit1.GetPrintDraw().EnumResolutions(XResolutions, YResolutions);
//various programming code
EEEEEEE
} __finally {
HeapFree(GetProcessHeap(), 0, XResolutions);
HeapFree(GetProcessHeap(), 0, YResolutions);
}