Forum Discussion

nastya_e's avatar
nastya_e
Occasional Contributor
11 years ago

Get the default printer

Добрый день. Как  определить принтер, который в настоящий момент используется по умолчанию. Написание тестов на delphiscript Locator: = Sys.OleObject ('WbemScripting.SWbemLocator'); WmiSe...
  • joseph_michaud's avatar
    11 years ago
    In the meantime you can try using the WbemObjectSet methods to enumerate the list:



      WbemObjectSet := WmiService.ExecQuery('Select * from Win32_Printer Where Default = True');

      count := WbemObjectSet.Count;

      for i := 0 to count - 1 do

      begin

        WbemObject := WbemObjectSet.ItemIndex(i);

        Log.Message(WbemObject.Name);

      end;