This method retrieves a list of supported resolutions for the printer designated by the printer name.
Parameters
Name | Explanation |
---|---|
XResolutions | An array containing the list of retrieved X resolutions |
YResolutions | An array containing the list of retrieved Y
resolutions
(1)In Visual C++, pass the pointer to the first element of the array (2)In Visual Basic, Dim XRes(0 To 2) As Integer then set XRes(0) |
Return Value
Returns the number of retrieved items. Returns 0 if unsuccessful.
Explanation
The EnumResolutions method retrieves a list of supported resolutions for the printer designated by the printer name. If you need to know the number of elements in the array, the GetArrayNum method can be used to retrieve this. The XResolutions and YResolutions parameters contains the retrieved (horizontal and vertical) resolution values in units of dots per inch (dpi)
For scripting languages and other programs that require variant types, please refer to the EnumResolutionsVariant method.
Sample code:
Visual Basic
Dim Size As Long
Dim XResolutions() As Long
Dim YResolutions() As Long
Dim Ret As Long
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"
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
..............
} __finally {
HeapFree(GetProcessHeap(), 0, XResolutions);
HeapFree(GetProcessHeap(), 0, YResolutions);
}