Код:
Func Prnbutton()

	GUISetState(@SW_DISABLE, $mainwindow)

	$printers = ""
	$defPrntr = ""
	$strComputer = "."
	$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
	$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer")

	For $objItem In $colItems
    $printers = $printers & ($objItem.Caption & "|") ; ", Имя порта: " & $objItem.PortName &
    If StringInStr($objItem.Caption, "pdf") Then
    	$defPrntr = $objItem.Name
    EndIf

    If StringInStr($objItem.Caption, "XPS") And $defPrntr = "" Then
    	$defPrntr = $objItem.Name
    EndIf
	Next

	If $defPrntr = "" Then
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
    $colPrinters = $objWMIService.ExecQuery("Select * From Win32_Printer Where Default = True")

    For $objPrinter In $colPrinters
    	$defPrntr = $objPrinter.Name
    Next
	EndIf

	; отрисовываем окно выбора принтера и опций
	Global $pGui = GUICreate("Выбор настроек принтера", 400, 310, Default, Default, $WS_BORDER, -1, $mainwindow)
	GUICtrlCreateLabel("Выбор принтера", 10, 8, 100, 50, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")
	Global $printer = GUICtrlCreateCombo("", 120, 10, 260, 40, $CBS_DROPDOWNLIST + $WS_VSCROLL)
	GUICtrlSetFont(-1, 09, 700, 0, "Verdana")

	GUICtrlSetData($printer, $printers, $defPrntr)

	GUICtrlCreateLabel("Печать билетов с:", 30, 55, 160, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 09, 700, 0, "Verdana")

	$diap = ""
	For $s = 1 To _GUICtrlListView_GetItemCount($idListView)
    $diap = $diap & "|" & $s
	Next

	Global $dstart = GUICtrlCreateCombo("", 200, 50, 60, 28, $CBS_DROPDOWNLIST + $WS_VSCROLL)
	GUICtrlSetFont(-1, 10, 700, 0, "Verdana")

	GUICtrlSetData($dstart, $diap, 1)

	GUICtrlCreateLabel("по:", 270, 55, 30, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 09, 700, 0, "Verdana")

	Global $dend = GUICtrlCreateCombo("", 300, 50, 60, 28, $CBS_DROPDOWNLIST + $WS_VSCROLL)
	GUICtrlSetFont(-1, 10, 700, 0, "Verdana")

	GUICtrlSetData($dend, $diap, _GUICtrlListView_GetItemCount($idListView))


	; выбор печатаемых документов
	Global $Chbilet01 = GUICtrlCreateCheckbox("", 10, 80, 20, 28)
	GUICtrlSetState(-1, $GUI_CHECKED)
	GUICtrlCreateLabel("Билеты", 30, 85, 360, 20, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	Global $Chbilet02 = GUICtrlCreateCheckbox("", 10, 105, 20, 28)
	GUICtrlSetState(-1, $GUI_CHECKED)
	GUICtrlCreateLabel("Листы проверки", 30, 110, 360, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	Global $Chbilet03 = GUICtrlCreateCheckbox("", 10, 130, 20, 28)
	GUICtrlSetState(-1, $GUI_CHECKED)
	GUICtrlCreateLabel("Лист проверки с ответами", 30, 135, 360, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	GUICtrlCreateLabel("--- дополнительные опции ---", 30, 160, 380, 18, $SS_CENTER)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	Global $Chbilet04 = GUICtrlCreateCheckbox("", 10, 180, 20, 28)
	GUICtrlSetState(-1, $GUI_UNCHECKED)
	GUICtrlCreateLabel("Сборники вопросов", 30, 185, 360, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	Global $Chbilet05 = GUICtrlCreateCheckbox("", 10, 205, 20, 28)
	GUICtrlSetState(-1, $GUI_UNCHECKED)
	GUICtrlCreateLabel("Сборники с правильными ответами", 30, 210, 360, 18, $SS_LEFT)
	GUICtrlSetFont(-1, 9, 700, 0, "Verdana")

	; отрисовка кнопок печать и отмена
	$Print = GUICtrlCreateButton("Печать", 90, 240, 100, 40, $BS_MULTILINE + $BS_CENTER)
	GUICtrlSetFont(-1, 12, 700, 0, "Verdana")
	$ButtonCancel3 = GUICtrlCreateButton("Отмена", 200, 240, 100, 40, $BS_MULTILINE + $BS_CENTER)
	GUICtrlSetFont(-1, 12, 700, 0, "Verdana")

	GUISetState(@SW_SHOW)

	GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

	GUICtrlSetOnEvent($Print, "Print")
	GUICtrlSetOnEvent($ButtonCancel3, "ButtonCancel3")
	GUISetState()

EndFunc   ;==>Prnbutton