Count: Integer;
The Count property returns the number of devices in the list of printers available for printing.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
MP: IMetabasePolicy;
DP: IMetabaseDevicePolicy;
DevDess: IMetabaseDeviceDescriptors;
DevDes: IMetabaseDeviceDescriptor;
i: Integer;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
MP := Ms.Policy;
DP := MP.PrintersPolicy;
DevDess := DP.Enumerate;
For i:=0 To DevDess.Count-1 Do
DevDes:= DevDess.Item(0);
Debug.WriteLine(DevDes.DeviceName);
Debug.WriteLine(DevDes.Key);
Debug.WriteLine("----------------");
End For;
End Sub UserProc;
After executing the example device name and key are displayed in the console.
See also: